Rocksolid Light

News from da outaworlds

mail  files  register  groups  login

Message-ID:  

BOFH excuse #223: The lines are all busy (busied out, that is -- why let them in to begin with?).


comp / comp.lang.scheme / Re: concentric loops

SubjectAuthor
* Re: concentric loopsB. Pym
`- Re: concentric loopsKaz Kylheku

1
Subject: Re: concentric loops
From: B. Pym
Newsgroups: comp.lang.lisp, comp.lang.scheme
Organization: A noiseless patient Spider
Date: Thu, 12 Sep 2024 04:41 UTC
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: Nobody447095@here-nor-there.org (B. Pym)
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: Re: concentric loops
Date: Thu, 12 Sep 2024 04:41:56 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 22
Message-ID: <vbtreg$33ap$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Thu, 12 Sep 2024 06:41:57 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="15295cbec5a95e756a39a07bb6746ed8";
logging-data="101721"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190RxkEUZ5NYceJ1oF0i0HB"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:cGc7kc3KGAL9WzehjR7aCgtIMFk=
View all headers

Peter Seibel wrote:

> > --> ( 11 12 13 21 22 23 31 32 33)
> >
> > I know that in CL plus is replaced by +, but how can I
> > handle the mapcar inside the mapcan?
>
> (loop for x from 10 to 30 by 10 nconcing
> (loop for y from 1 to 3 collect (+ x y)))

Gauche Scheme

(use srfi-42) ; list-ec

(list-ec (:range x 10 31 10) (:range y 1 4) (+ x y))

===>
(11 12 13 21 22 23 31 32 33)

Shorter:

(list-ec (: x 10 31 10) (: y 1 4) (+ x y))

Subject: Re: concentric loops
From: Kaz Kylheku
Newsgroups: comp.lang.lisp, comp.lang.scheme
Organization: A noiseless patient Spider
Date: Thu, 12 Sep 2024 12:26 UTC
References: 1
Path: eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: 643-408-1753@kylheku.com (Kaz Kylheku)
Newsgroups: comp.lang.lisp,comp.lang.scheme
Subject: Re: concentric loops
Date: Thu, 12 Sep 2024 12:26:44 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 33
Message-ID: <20240912052353.211@kylheku.com>
References: <vbtreg$33ap$1@dont-email.me>
Injection-Date: Thu, 12 Sep 2024 14:26:45 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="fc240c90c706e031471363b92b2225a2";
logging-data="270113"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18fE/GYexu030WCUHrX36/gRdWR/S6fTBc="
User-Agent: slrn/pre1.0.4-9 (Linux)
Cancel-Lock: sha1:VK0Wn8Ki9R9oCK8MWsZHUdJxhdY=
View all headers

On 2024-09-12, B. Pym <Nobody447095@here-nor-there.org> wrote:
> Peter Seibel wrote:
>
>> > --> ( 11 12 13 21 22 23 31 32 33)
>> >
>> > I know that in CL plus is replaced by +, but how can I
>> > handle the mapcar inside the mapcan?
>>
>> (loop for x from 10 to 30 by 10 nconcing
>> (loop for y from 1 to 3 collect (+ x y)))
>
> Gauche Scheme
>
> (use srfi-42) ; list-ec
>
> (list-ec (:range x 10 31 10) (:range y 1 4) (+ x y))
>
> ===>
> (11 12 13 21 22 23 31 32 33)
>
> Shorter:
>
> (list-ec (: x 10 31 10) (: y 1 4) (+ x y))

TXR Lisp:

1> [maprod + (range 10 31 10) 1..4]
(11 12 13 21 22 23 31 32 33)

--
TXR Programming Language: http://nongnu.org/txr
Cygnal: Cygwin Native Application Library: http://kylheku.com/cygnal
Mastodon: @Kazinator@mstdn.ca

1

rocksolid light 0.9.8
clearnet tor