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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,effb80d4bb7716dd X-Google-Attributes: gid103376,public From: dennison@telepath.com Subject: Re: Wanted: Ada STL. Reward: Ada's Future Date: 1999/02/01 Message-ID: <794hhq$1dk$1@nnrp1.dejanews.com>#1/1 X-Deja-AN: 439372449 References: <790f4q$3l@bgtnsc01.worldnet.att.net> X-Http-Proxy: 1.0 x2.dejanews.com:80 (Squid/1.1.22) for client 204.48.27.130 Organization: Deja News - The Leader in Internet Discussion X-Article-Creation-Date: Mon Feb 01 15:34:18 1999 GMT Newsgroups: comp.lang.ada X-Http-User-Agent: Mozilla/4.5 [en] (WinNT; I) Date: 1999-02-01T00:00:00+00:00 List-Id: In article <790f4q$3l@bgtnsc01.worldnet.att.net>, "Alexy V Khrabrov" wrote: > Consider this simple task: a set. In C++, you get it from the STL. How do > you get one in Ada? Back in the Ada 83 days I looked into creating a reusable set package, along the lines of the SET type available for Pascal and Modula-2. What I quickly discovered was that Ada's support for Boolean operations on arrays of booleans made it completely unnessecary. For all intents and purposes, you *do* have a set type in Ada! Example: type Color is (Red, Green, Blue, Black, Teal); type Color_Set is array (Color) of Boolean; Palette : Color_Set; Inclusion: if Palette(Red) then ... Intersection: Colorblind_Palette := Palette and Colorblind_Visible_Colors; Union: Palette := Palette or Colors_At_The_Artshop; Negation: Unavailable_Colors := not Palette; etc. Admittedly, an implementation of a very large sparse set using only boolean arrays is not the best way to go. But I have yet to ever need that functionality myself... T.E.D. -----------== Posted via Deja News, The Discussion Network ==---------- http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own