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

Liste des GroupesRevenir à cl lisp 
Sujet : Re: SBCL complains where Lispwork does not: loop for i for j
De : Nobody447095 (at) *nospam* here-nor-there.org (B. Pym)
Groupes : comp.lang.lisp
Date : 07. Aug 2024, 20:40:53
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v90f3h$39c5h$1@dont-email.me>
User-Agent : XanaNews/1.18.1.6
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))

Date Sujet#  Auteur
7 Aug 24 o Re: SBCL complains where Lispwork does not: loop for i for j1B. Pym

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal