• Re: concentric loops

    From B. Pym@Nobody447095@here-nor-there.org to comp.lang.lisp on Sat Aug 23 11:22:55 2025
    From Newsgroup: comp.lang.lisp

    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)))

    Using "do" instead of "loop" makes the solution shorter.

    Gauche Scheme

    (do ((x 30 (- x 10))
    (r () (append (map (pa$ + x) (iota 3 1)) r)))
    ((= x 0) r))

    (11 12 13 21 22 23 31 32 33)
    --
    [T]he problem is that lispniks are as cultish as any other devout group and basically fall down frothing at the mouth if they see [heterodoxy].
    --- Kenny Tilton
    The good news is, it's not Lisp that sucks, but Common Lisp. --- Paul Graham --- Synchronet 3.21a-Linux NewsLink 1.2