Rocksolid Light

Welcome to RetroBBS

mail  files  register  newsreader  groups  login

Message-ID:  

The meek are contesting the will.


devel / comp.lang.ada / How to exit from "for t in C when f(t) loop" ?

SubjectAuthor
* How to exit from "for t in C when f(t) loop" ?reinert
`* Re: How to exit from "for t in C when f(t) loop" ?reinert
 `* Re: How to exit from "for t in C when f(t) loop" ?min...@gmail.com
  `* Re: How to exit from "for t in C when f(t) loop" ?reinert
   +- Re: How to exit from "for t in C when f(t) loop" ?Jere
   `* Re: How to exit from "for t in C when f(t) loop" ?AdaMagica
    `- Re: How to exit from "for t in C when f(t) loop" ?Stephen Leake

1
How to exit from "for t in C when f(t) loop" ?

<7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10208&group=comp.lang.ada#10208

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ac8:60d9:0:b0:419:be59:aba0 with SMTP id i25-20020ac860d9000000b00419be59aba0mr155521qtm.13.1698037380085;
Sun, 22 Oct 2023 22:03:00 -0700 (PDT)
X-Received: by 2002:a05:6808:182a:b0:3ae:1691:c59f with SMTP id
bh42-20020a056808182a00b003ae1691c59fmr3622351oib.1.1698037379835; Sun, 22
Oct 2023 22:02:59 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer02.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sun, 22 Oct 2023 22:02:59 -0700 (PDT)
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
Subject: How to exit from "for t in C when f(t) loop" ?
From: reinkor@gmail.com (reinert)
Injection-Date: Mon, 23 Oct 2023 05:03:00 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1422
 by: reinert - Mon, 23 Oct 2023 05:02 UTC

Assume the loop:

for t of C loop
if f(t) then
do something....
elsif f(t) > f1 then
exit;
end if;
end loop;

I would like to simplify this construct (somehow) like this:

for t of C when f(t) loop
do something....
end loop;

However, this is not computationally effective, since t in this case runs through the whole C.
Any ideas for a compromise?

reinert

Re: How to exit from "for t in C when f(t) loop" ?

<669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10209&group=comp.lang.ada#10209

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:21ce:b0:778:9650:a574 with SMTP id h14-20020a05620a21ce00b007789650a574mr130772qka.8.1698044669047;
Mon, 23 Oct 2023 00:04:29 -0700 (PDT)
X-Received: by 2002:a05:6871:5207:b0:1e5:bc65:26f2 with SMTP id
ht7-20020a056871520700b001e5bc6526f2mr4257211oac.3.1698044668832; Mon, 23 Oct
2023 00:04:28 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Mon, 23 Oct 2023 00:04:28 -0700 (PDT)
In-Reply-To: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: reinkor@gmail.com (reinert)
Injection-Date: Mon, 23 Oct 2023 07:04:29 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1727
 by: reinert - Mon, 23 Oct 2023 07:04 UTC

mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> Assume the loop:
>
> for t of C loop
> if f(t) then
> do something....
> elsif f(t) > f1 then
> exit;
> end if;
> end loop;
>
> I would like to simplify this construct (somehow) like this:
>
> for t of C when f(t) loop
> do something....
> end loop;
>
> However, this is not computationally effective, since t in this case runs through the whole C.
> Any ideas for a compromise?
>
> reinert
Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert

Re: How to exit from "for t in C when f(t) loop" ?

<ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10211&group=comp.lang.ada#10211

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:1107:b0:778:8eac:460 with SMTP id o7-20020a05620a110700b007788eac0460mr225543qkk.7.1698201176696;
Tue, 24 Oct 2023 19:32:56 -0700 (PDT)
X-Received: by 2002:a05:6808:148e:b0:3a8:8470:fe6a with SMTP id
e14-20020a056808148e00b003a88470fe6amr5167544oiw.6.1698201176459; Tue, 24 Oct
2023 19:32:56 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Tue, 24 Oct 2023 19:32:56 -0700 (PDT)
In-Reply-To: <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=110.174.123.6; posting-account=uDLjqAoAAACt8a0xeVi3oCavO0f84_b-
NNTP-Posting-Host: 110.174.123.6
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com> <669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: minghia@gmail.com (min...@gmail.com)
Injection-Date: Wed, 25 Oct 2023 02:32:56 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2236
 by: min...@gmail.com - Wed, 25 Oct 2023 02:32 UTC

On Monday, October 23, 2023 at 6:04:30 PM UTC+11, reinert wrote:
> mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> > Assume the loop:
> >
> > for t of C loop
> > if f(t) then
> > do something....
> > elsif f(t) > f1 then
> > exit;
> > end if;
> > end loop;
> >
> > I would like to simplify this construct (somehow) like this:
> >
> > for t of C when f(t) loop
> > do something....
> > end loop;
> >
> > However, this is not computationally effective, since t in this case runs through the whole C.
> > Any ideas for a compromise?
> >
> > reinert
> Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert
Normally one does something
t := C'first;
loop
do something...
exit when Condition;
t := t + 1;
end loop;

The conditon is just a boolean expression. It can be as simple or as complicated as one desires.

Re: How to exit from "for t in C when f(t) loop" ?

<e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10223&group=comp.lang.ada#10223

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:4f0b:0:b0:66d:542:d6b5 with SMTP id fb11-20020ad44f0b000000b0066d0542d6b5mr47790qvb.9.1698418393874;
Fri, 27 Oct 2023 07:53:13 -0700 (PDT)
X-Received: by 2002:a9d:62c6:0:b0:6c4:58bd:290d with SMTP id
z6-20020a9d62c6000000b006c458bd290dmr1622456otk.3.1698418393669; Fri, 27 Oct
2023 07:53:13 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder8.news.weretis.net!feeder1.feed.usenet.farm!feed.usenet.farm!peer02.ams4!peer.am4.highwinds-media.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 27 Oct 2023 07:53:13 -0700 (PDT)
In-Reply-To: <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=84.209.88.37; posting-account=bPTmZAoAAAC_6HP9XLKB9aAAxBa6BuOR
NNTP-Posting-Host: 84.209.88.37
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
<669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: reinkor@gmail.com (reinert)
Injection-Date: Fri, 27 Oct 2023 14:53:13 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2725
 by: reinert - Fri, 27 Oct 2023 14:53 UTC

I would like an exit possibility somehow like this:

for t of C when f(t), but exit when f(t) loop
do something....
end loop;

Three lines less - keeping errors down :-)

reinert

onsdag 25. oktober 2023 kl. 04:32:58 UTC+2 skrev min...@gmail.com:
> On Monday, October 23, 2023 at 6:04:30 PM UTC+11, reinert wrote:
> > mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> > > Assume the loop:
> > >
> > > for t of C loop
> > > if f(t) then
> > > do something....
> > > elsif f(t) > f1 then
> > > exit;
> > > end if;
> > > end loop;
> > >
> > > I would like to simplify this construct (somehow) like this:
> > >
> > > for t of C when f(t) loop
> > > do something....
> > > end loop;
> > >
> > > However, this is not computationally effective, since t in this case runs through the whole C.
> > > Any ideas for a compromise?
> > >
> > > reinert
> > Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert
> Normally one does something
> t := C'first;
> loop
> do something...
> exit when Condition;
> t := t + 1;
> end loop;
>
> The conditon is just a boolean expression. It can be as simple or as complicated as one desires.

Re: How to exit from "for t in C when f(t) loop" ?

<0c22bace-74bc-48a7-adc7-541357899dc0n@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10226&group=comp.lang.ada#10226

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:3c94:b0:76f:513:7a8c with SMTP id tp20-20020a05620a3c9400b0076f05137a8cmr57627qkn.2.1698445697994;
Fri, 27 Oct 2023 15:28:17 -0700 (PDT)
X-Received: by 2002:a05:6870:218a:b0:1e9:a253:afb1 with SMTP id
l10-20020a056870218a00b001e9a253afb1mr1687860oae.9.1698445697641; Fri, 27 Oct
2023 15:28:17 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer01.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Fri, 27 Oct 2023 15:28:17 -0700 (PDT)
In-Reply-To: <e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=96.241.34.211; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf
NNTP-Posting-Host: 96.241.34.211
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
<669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
<e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0c22bace-74bc-48a7-adc7-541357899dc0n@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: jhb.chat@gmail.com (Jere)
Injection-Date: Fri, 27 Oct 2023 22:28:17 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
X-Received-Bytes: 2977
 by: Jere - Fri, 27 Oct 2023 22:28 UTC

On Friday, October 27, 2023 at 10:53:15 AM UTC-4, reinert wrote:
> I would like an exit possibility somehow like this:
>
> for t of C when f(t), but exit when f(t) loop
> do something....
> end loop;
>
> Three lines less - keeping errors down :-)
>
> reinert
> onsdag 25. oktober 2023 kl. 04:32:58 UTC+2 skrev :
> > On Monday, October 23, 2023 at 6:04:30 PM UTC+11, reinert wrote:
> > > mandag 23. oktober 2023 kl. 07:03:01 UTC+2 skrev reinert:
> > > > Assume the loop:
> > > >
> > > > for t of C loop
> > > > if f(t) then
> > > > do something....
> > > > elsif f(t) > f1 then
> > > > exit;
> > > > end if;
> > > > end loop;
> > > >
> > > > I would like to simplify this construct (somehow) like this:
> > > >
> > > > for t of C when f(t) loop
> > > > do something....
> > > > end loop;
> > > >
> > > > However, this is not computationally effective, since t in this case runs through the whole C.
> > > > Any ideas for a compromise?
> > > >
> > > > reinert
> > > Just a correction of the subject, it should be: How to exit from "for t *of* C when f(t) loop ? -reinert
> > Normally one does something
> > t := C'first;
> > loop
> > do something...
> > exit when Condition;
> > t := t + 1;
> > end loop;
> >
> > The conditon is just a boolean expression. It can be as simple or as complicated as one desires.

Would the new Ada22 feature of iterator filters help at all?
http://www.ada-auth.org/standards/22over/html/Ov22-4-6.html

Re: How to exit from "for t in C when f(t) loop" ?

<4f32385a-061e-44bf-b197-a080d2ee1aban@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10227&group=comp.lang.ada#10227

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:a05:620a:8794:b0:774:793:e7cc with SMTP id py20-20020a05620a879400b007740793e7ccmr85736qkn.1.1698504129473;
Sat, 28 Oct 2023 07:42:09 -0700 (PDT)
X-Received: by 2002:a05:6808:155:b0:3ab:81e4:4d78 with SMTP id
h21-20020a056808015500b003ab81e44d78mr1447583oie.8.1698504129306; Sat, 28 Oct
2023 07:42:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!news.1d4.us!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!peer03.iad!feed-me.highwinds-media.com!news.highwinds-media.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 28 Oct 2023 07:42:08 -0700 (PDT)
In-Reply-To: <e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=2a00:6020:462f:c400:a49f:4121:7ec4:cfb4;
posting-account=rmHyLAoAAADSQmMWJF0a_815Fdd96RDf
NNTP-Posting-Host: 2a00:6020:462f:c400:a49f:4121:7ec4:cfb4
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
<669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
<e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <4f32385a-061e-44bf-b197-a080d2ee1aban@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: christ-usch.grein@t-online.de (AdaMagica)
Injection-Date: Sat, 28 Oct 2023 14:42:09 +0000
Content-Type: text/plain; charset="UTF-8"
X-Received-Bytes: 1703
 by: AdaMagica - Sat, 28 Oct 2023 14:42 UTC

reinert schrieb am Freitag, 27. Oktober 2023 um 16:53:15 UTC+2:
> I would like an exit possibility somehow like this:
>
> for t of C when f(t), but exit when f(t)
except when Y then skip next -- many more lines saved ;-)
> loop
> do something....
> end loop;
>
> Three lines less - keeping errors down :-)

Re: How to exit from "for t in C when f(t) loop" ?

<b541341b-cdea-4dba-93a9-d329ce47b03fn@googlegroups.com>

  copy mid

https://www.rocksolidbbs.com/devel/article-flat.php?id=10228&group=comp.lang.ada#10228

  copy link   Newsgroups: comp.lang.ada
X-Received: by 2002:ad4:4f03:0:b0:66d:365:a767 with SMTP id fb3-20020ad44f03000000b0066d0365a767mr101207qvb.8.1698513369269;
Sat, 28 Oct 2023 10:16:09 -0700 (PDT)
X-Received: by 2002:a05:6808:3601:b0:3b2:e488:a5d4 with SMTP id
ct1-20020a056808360100b003b2e488a5d4mr1701930oib.9.1698513369030; Sat, 28 Oct
2023 10:16:09 -0700 (PDT)
Path: i2pn2.org!i2pn.org!newsfeed.endofthelinebbs.com!weretis.net!feeder6.news.weretis.net!border-2.nntp.ord.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.lang.ada
Date: Sat, 28 Oct 2023 10:16:08 -0700 (PDT)
In-Reply-To: <4f32385a-061e-44bf-b197-a080d2ee1aban@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=135.180.41.253; posting-account=W2gdXQoAAADxIuhBWhPFjUps3wUp4RhQ
NNTP-Posting-Host: 135.180.41.253
References: <7e5b4c92-6648-440d-85b3-c06d84ac9ce8n@googlegroups.com>
<669ad4ee-8004-44ea-a04a-a491ef9d0b28n@googlegroups.com> <ec7ddbde-3a15-484b-b74c-f368b3e0c181n@googlegroups.com>
<e2a3d69e-e19e-4da1-8a33-7f6db63b7f21n@googlegroups.com> <4f32385a-061e-44bf-b197-a080d2ee1aban@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <b541341b-cdea-4dba-93a9-d329ce47b03fn@googlegroups.com>
Subject: Re: How to exit from "for t in C when f(t) loop" ?
From: stephen.leake84@gmail.com (Stephen Leake)
Injection-Date: Sat, 28 Oct 2023 17:16:09 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 24
 by: Stephen Leake - Sat, 28 Oct 2023 17:16 UTC

On Saturday, October 28, 2023 at 7:42:10 AM UTC-7, AdaMagica wrote:
> reinert schrieb am Freitag, 27. Oktober 2023 um 16:53:15 UTC+2:
> > I would like an exit possibility somehow like this:
> >
> > for t of C when f(t), but exit when f(t)
> except when Y then skip next -- many more lines saved ;-)
> > loop
> > do something....
> > end loop;
> >
'exit when condition;' is perfectly legal Ada.

It is more problematic that you are executing f(t) twice; that's either wrong if it has side effects, or wasteful if not.
And you are treating f(t) as returning a Boolean and a scalar!

for t of C loop
declare
A : foo renames f(t);
begin
exit when A; -- Boolean
exit when A >= f1; -- scalar
do something;
end;
end loop;

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor