Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 23 |
Nodes: | 6 (0 / 6) |
Uptime: | 52:45:04 |
Calls: | 583 |
Files: | 1,139 |
D/L today: |
179 files (27,921K bytes) |
Messages: | 111,617 |
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))
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))
((0 . A) (1 . B) (2 . C))
((0 . A) (1 . B))
((0 . A) (1 . B) (2 . C))
((9 . A) (8 . B) (7 . C))
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))