(column num lst)

Started by Dmi, March 18, 2008, 12:17:23 AM

Previous topic - Next topic

Dmi

Hi, All!



Testing with new function:
(define (column n lst)
  (map (fn(x) (x n)) lst))

> (set 'lst '((a 1 q)(b 2 w)(c 3 e)))
((a 1 q) (b 2 w) (c 3 e))
> (column 1 lst)
(1 2 3)
WBR, Dmi

Lutz

#1
you can also use transpose:


(set 'lst '((a 1 q)(b 2 w)(c 3 e)))

((transpose lst) 1) => (1 2 3)

Dmi

#2
Oh! Nice :-)
WBR, Dmi