Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

It is not every question that deserves an answer. -- Publilius Syrus


devel / comp.lang.lisp / Re: ( for... break... else ) in Common Lisp and Scheme ?

SubjectAuthor
o Re: ( for... break... else ) in Common Lisp and Scheme ?Madhu

1
Re: ( for... break... else ) in Common Lisp and Scheme ?

<m3pm8jynvx.fsf@leonis4.robolove.meer.net>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=2635&group=comp.lang.lisp#2635

  copy link   Newsgroups: comp.lang.lisp
Path: rocksolid2!i2pn.org!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From: enometh@meer.net (Madhu)
Newsgroups: comp.lang.lisp
Subject: Re: ( for... break... else ) in Common Lisp and Scheme ?
Date: Wed, 05 Apr 2023 09:35:38 +0530
Organization: Motzarella
Lines: 49
Message-ID: <m3pm8jynvx.fsf@leonis4.robolove.meer.net>
References: <d568b860-a810-4506-8807-cc1d4c4ad74an@googlegroups.com>
<m3pm9m9pri.fsf@leonis4.robolove.meer.net>
<86edq1wz9h.fsf@williamsburg.bawden.org>
<m3ilfdaft1.fsf@leonis4.robolove.meer.net>
MIME-Version: 1.0
Content-Type: text/plain
Injection-Info: dont-email.me; posting-host="3378baaf3f9b20ba63ee3cd0fef6f1bf";
logging-data="3960324"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+fAo47gL8ISutr65euxLiCsayAdGA6SNs="
Cancel-Lock: sha1:o3Xw7c2zatr5CWmdB13eYPQdbtU=
sha1:O7x6wxprROM+YCFLPBnWZOJuJtI=
 by: Madhu - Wed, 5 Apr 2023 04:05 UTC

* Madhu <m3ilfdaft1.fsf @leonis4.robolove.meer.net> :
Wrote on Tue, 07 Mar 2023 00:05:38 +0530:
> * Alan Bawden <86edq1wz9h.fsf @williamsburg.bawden.org> :
> Wrote on Mon, 06 Mar 2023 12:44:26 -0500:
>> No, it really does match the 'for x'. This use of 'else' is a
>> (controversial) feature of Python. The code above is quoted directly
>> from the Python tutorial at the given URL, which nicely explains how
>> it works.
> Thanks for pointing it out. ("My blushes if it were possible]")

I had a chance to revisit this, and suggest to myself that the for-else
feature is another not-really-elegant quirk of the python designers'
minds --- if the idea is to offer control-flow

I want to modify some python code with a for loop:
```
for x in [XXX]:
DO-THINGS
```
to skip DO-THINGS if x was in another set [YYY], i.e. the desired
control flow is

```
for x in [XXX]:
for y in [YYY]:
if x == y:
CONTINUE-OUTER-LOOP
DO-THINGS
```

Python of course doesn't have CONTINUE-OUTER-LOOP. The for-else
construct suggests I can expect python to continue evaluation of the
outer loop when breaking out of the inner loop. However it doesn't cover
that. I have to explicitly do, in the inner loop
```
skip = false
for y in [YYY]:
if x == y:
skip = true
break
else:
pass # else is of no help here
if skip continue # the outer loop
```
and the control flow is as clunky as it can be.

>> It's controversial, not because there is something wrong with the
>> feature itself, but because many people find naming it 'else' to be
>> confusing.

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor