• Re: SBCL complains where Lispwork does not: loop for i for j

    From B. Pym@21:1/5 to Jochen on Wed Aug 7 18:40:53 2024
    Jochen wrote:

    This ...

    CL-USER 1 > (loop for i for j in '(a b c) collect (cons i j))
    ((0 . A) (1 . B) (2 . C))

    works perfectly on LispWorks, but not with SBCL

    FOR is an unknown keyword in FOR or AS clause in LOOP.

    I found a way around it 'for i from 0' but am not sure if there is
    another smarter way to achieve this.

    I think the canonical way would be

    (loop for i upfrom 0
    for j in '(a b c)
    collect (cons i j))

    newLISP

    (map (curry list $idx) '(a b c))

    ((0 a) (1 b) (2 c))

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)