comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: SET in Ada?
Date: Sat, 15 Mar 2003 02:11:02 GMT
Date: 2003-03-15T02:11:02+00:00	[thread overview]
Message-ID: <3E728C0B.6080206@acm.org> (raw)
In-Reply-To: 3E7203B0.B5B7E076@alfred-hilscher.de

Alfred wrote:
> Hi I'm trying to convert some Modula code to Ada. There is a statement
> like this:
> 
> IF i in {1,5,13,21}  THEN ...
> 
> How could this be translated to Ada, because as far as I know, Ada has
> no similar "SET" handling.

You could use PragmArc.Set_Discrete from the PragmAda Reusable Components

http://home.earthlink.net/~jrcarter010/pragmarc.htm

In which case your example would be written as

if Member (I, Make ((1, 5, 13, 21)) then

However, that's a poor use of sets. If you're not defining sets and 
checking for membership in a set variable you probably want a case 
statement.

-- 
Jeff Carter
"That was the most fun I've ever had without laughing."
Annie Hall




      parent reply	other threads:[~2003-03-15  2:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-03-14 16:30 SET in Ada? Alfred
2003-03-14 16:45 ` Jeffrey Creem
2003-03-14 17:23 ` Robert A Duff
2003-03-15  2:11 ` Jeffrey Carter [this message]
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox