Sujet : Re: concentric loops
De : 643-408-1753 (at) *nospam* kylheku.com (Kaz Kylheku)
Groupes : comp.lang.lisp comp.lang.schemeDate : 12. Sep 2024, 14:26:44
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <20240912052353.211@kylheku.com>
References : 1
User-Agent : slrn/pre1.0.4-9 (Linux)
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/txrCygnal: Cygwin Native Application Library: http://kylheku.com/cygnalMastodon: @Kazinator@mstdn.ca