From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.224.126.137 with SMTP id c9mr4615166qas.2.1379481558496; Tue, 17 Sep 2013 22:19:18 -0700 (PDT) X-Received: by 10.49.70.138 with SMTP id m10mr376302qeu.9.1379481558481; Tue, 17 Sep 2013 22:19:18 -0700 (PDT) Path: border1.nntp.dca3.giganews.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!d5no373842qap.0!news-out.google.com!gv3ni456qab.0!nntp.google.com!d5no373836qap.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Tue, 17 Sep 2013 22:19:18 -0700 (PDT) In-Reply-To: <4f66d847-d030-4aa9-8bdf-9bcc5f3a0852@googlegroups.com> Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=174.28.152.201; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC NNTP-Posting-Host: 174.28.152.201 References: <4f66d847-d030-4aa9-8bdf-9bcc5f3a0852@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: <58c932ec-9830-4ae2-8244-91d621d9d694@googlegroups.com> Subject: Re: Multiple keys for a map From: Shark8 Injection-Date: Wed, 18 Sep 2013 05:19:18 +0000 Content-Type: text/plain; charset=ISO-8859-1 X-Original-Bytes: 2765 Xref: number.nntp.dca.giganews.com comp.lang.ada:183375 Date: 2013-09-17T22:19:18-07:00 List-Id: On Tuesday, September 17, 2013 8:51:24 AM UTC-6, Peter Brooks wrote: > I know that maps in Containers.Hashed_Maps and Containers.Ordered_Map are designed as single-key look-up tables. > > Is there an extension that allows multiple keys? > > I'd like to be able to do something like this: > > procedure Insert (Container : in out Map; > key1, key2, key3 : in Key_Type; > New_Item : in Element_Type; > Position : out Cursor; > Inserted : out Boolean); > > allowing: > > insert(my_map,"fox","jumps","dog","The quick brown fox jumps over the lazy dog",location,succeeded); > insert(my_map,"cow","jumps","moon","The cow jumps over the moon",location,succeeded); > insert(my_map,"dog","jumps","log","The lazy dog jumps over the small log",location,succeeded); > insert(my_map,"dog","jumps","bed","The very lazy dog jumps into bed",location,succeeded) > > So that later, I can have: > Subject := find(my_map,"fox",-,-); > Verb := find(my_map,-,"jumps",-); > Object := find(my_map,-,-,"dog"); > > and, after this: > Subject = Verb = Object; > > I know this could be done with three calls to Insert, but I also want to be able to call: > > find(mymap,"fox","jumps","dog") => true > and > find(mymap,"dog","jumps","fox") => false > and, ideally, > find(myman,"dog",-,-) => > > "The Lazy dog jumps over the small log" > "The very lazy dog jumps into bed" > > Any suggestions? I'm vaguely reminded of Prolog by this question: this problem was basically the intro for the book I had.