Of course, after going through all of that you then see why loop is so
handy:
CL-USER> (defun nth-elements (n &rest lists)
(loop for item in lists collect (nth n item)))
NTH-ELEMENTS
CL-USER> (nth-elements 3 '(10 20 hello x world) '(-1 -2 -3 y) '(z0 z1 z2 z))
(X Y Z)
Of course, after going through all of that you then see why loop is so handy:
CL-USER> (defun nth-elements (n &rest lists)
(loop for item in lists collect (nth n item)))
NTH-ELEMENTS
CL-USER> (nth-elements 3 '(10 20 hello x world) '(-1 -2 -3 y) '(z0 z1 z2 z))
(X Y Z)
(define (nth-elements n . seqs)
(map (lambda (xs) (list-ref xs n)) seqs))
(nth-elements 3
'(10 20 hello x world)
'(-1 -2 -3 y)
'(z0 z1 z2 z))
===>
(x y z)
(x y z)Of course, after going through all of that you then see why loop is so
handy:
CL-USER> (defun nth-elements (n &rest lists)
(loop for item in lists collect (nth n item)))
NTH-ELEMENTS
CL-USER> (nth-elements 3 '(10 20 hello x world) '(-1 -2 -3 y) '(z0 z1 z2 z)) >>
(X Y Z)
(define (nth-elements n . seqs)
(map (lambda (xs) (list-ref xs n)) seqs))
(nth-elements 3
'(10 20 hello x world)
'(-1 -2 -3 y)
'(z0 z1 z2 z))
(map 3 '((10 20 hello x world) (-1 -2 -3 y) (z0 z1 z2 z)))
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 70 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 02:02:14 |
| Calls: | 949 |
| Calls today: | 1 |
| Files: | 1,325 |
| Messages: | 281,114 |