Sysop: | Amessyroom |
---|---|
Location: | Fayetteville, NC |
Users: | 27 |
Nodes: | 6 (0 / 6) |
Uptime: | 38:58:14 |
Calls: | 631 |
Calls today: | 2 |
Files: | 1,187 |
D/L today: |
23 files (29,781K bytes) |
Messages: | 174,061 |
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))