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 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!feeder.eternal-september.org!nntp-feed.chiark.greenend.org.uk!ewrotcd!newsfeed.xs3.de!news.jacob-sparre.dk!franka.jacob-sparre.dk!pnx.dk!.POSTED.rrsoftware.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: recursive map specification Date: Wed, 26 Jun 2019 00:23:45 -0500 Organization: JSA Research & Innovation Message-ID: References: <187147dc-94fe-4019-bc42-5b214db452db@googlegroups.com> Injection-Date: Wed, 26 Jun 2019 05:23:46 -0000 (UTC) Injection-Info: franka.jacob-sparre.dk; posting-host="rrsoftware.com:24.196.82.226"; logging-data="15967"; mail-complaints-to="news@jacob-sparre.dk" X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.7246 Xref: reader01.eternal-september.org comp.lang.ada:56768 Date: 2019-06-26T00:23:45-05:00 List-Id: wrote in message news:187147dc-94fe-4019-bc42-5b214db452db@googlegroups.com... > Hello, > > I want to specify a recursive map. To simplify the problem I use the > example of a person and its ancestors and ancestors ... The problem does > not seem special but I haven't found a solution. The approach below does > not compile: > > type person is record > name : unbounded_string; > end record; > > package tree is new ordered_maps > ( > key_type => person, > element_type => tree.map -- compiler error. "tree" undefined > ); > > Any ideas ? Thanks a lot ! This is the reason that we defined the Multiway_Tree, as it isn't sensible to define a recursive container. (Otherwise, a recursive list is essentially a tree.) If you also need a map (for instance, to make the names easily found), I'd suggest making a map of tree cursors, and keep the real data in the tree (where the relationships also live). Randy.