comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: How difficult is ada to learn?
Date: Thu, 30 Jun 2005 13:59:20 -0500
Date: 2005-06-30T13:59:20-05:00	[thread overview]
Message-ID: <mMKdnfE-XpTQ3VnfRVn-qg@megapath.net> (raw)
In-Reply-To: 42c40313$0$32193$39cecf19@news.twtelecom.net

"Matthew Heaney" <mheaney@on2.com> wrote in message
news:42c40313$0$32193$39cecf19@news.twtelecom.net...
Matt Heaney wrote:

> If not having "built-in" syntax is a hardship, then you can always
> define array-based set operations yourself.  For example, suppose we
> have a set whose element type is Integer, then we can do this:

The following example seems pretty confused.

> type Integer_Array is array (Positive range <>) of Integer;
>
> function "+" (IA : Integer) return Integer_Sets.Set is

What's the definition of "Integer_Sets.Set"? Shouldn't IA have type
Integer_Array, rather than Integer?

>    S : Set;
> begin
>    for Indx in IA'Range loop
>       S.Include (IA (Indx));
>    end loop;
>
>    return S;
> end;
>
> Now you can say:
>
> declare
>     S1 : Set := +(1, 2, 3);
>     S2 : Set := +(2, 3, 4);
>     S3 : Set := S1 or S2;
>     S4 : Set := S3 and +(1, 3);
>     S5 : Set := +(42, 43) or +(44, 45);

Presuming that Integer_Sets.Set has "or" and "and" operations.

                            Randy.






  parent reply	other threads:[~2005-06-30 18:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-06-30  0:44 How difficult is ada to learn? Sm704
2005-06-30  5:11 ` Ludovic Brenta
2005-06-30  6:15   ` Preben Randhol
2005-06-30 14:19 ` Gene
2005-06-30 14:34   ` Matthew Heaney
2005-06-30 15:00     ` Duncan Sands
2005-06-30 18:38     ` Gene
2005-06-30 19:32       ` Matthew Heaney
2005-06-30 18:59     ` Randy Brukardt [this message]
2005-06-30 19:36       ` Matthew Heaney
2005-06-30 15:01   ` Matthew Heaney
2005-06-30 22:35     ` Robert A Duff
2005-07-15  2:27       ` Waldek Hebisch
2005-07-15  5:14         ` Ludovic Brenta
2005-07-01  5:37     ` Jeffrey Carter
2005-06-30 16:43 ` Martin Krischik
2005-06-30 19:36 ` svaa
2005-06-30 22:53 ` chris
2005-06-30 22:54   ` chris
2005-07-01  5:39   ` Jeffrey Carter
replies disabled

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