Deutsch   English   Français   Italiano  
<v90f3h$39c5h$1@dont-email.me>

View for Bookmarking (what is this?)
Look up another Usenet article

Path: ...!weretis.net!feeder8.news.weretis.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From: "B. Pym" <Nobody447095@here-nor-there.org>
Newsgroups: comp.lang.lisp
Subject: Re: SBCL complains where Lispwork does not: loop for i for j
Date: Wed, 7 Aug 2024 18:40:53 -0000 (UTC)
Organization: A noiseless patient Spider
Lines: 25
Message-ID: <v90f3h$39c5h$1@dont-email.me>
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
Injection-Date: Wed, 07 Aug 2024 20:40:54 +0200 (CEST)
Injection-Info: dont-email.me; posting-host="7094501a9f209988b45d39573ac7d250";
	logging-data="3453105"; mail-complaints-to="abuse@eternal-september.org";	posting-account="U2FsdGVkX18F9bLjCRU3vnfDCBPtsDXi"
User-Agent: XanaNews/1.18.1.6
Cancel-Lock: sha1:gvzo2yut/4SdPxkP2vo0WYLXlzM=
Bytes: 1469

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