newLISP Fan Club

Forum => newLISP newS => Topic started by: Dmi on March 18, 2008, 12:17:23 AM

Title: (column num lst)
Post by: Dmi on March 18, 2008, 12:17:23 AM
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)
Title:
Post by: Lutz on March 18, 2008, 06:29:25 AM
you can also use transpose:


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

((transpose lst) 1) => (1 2 3)
Title:
Post by: Dmi on March 18, 2008, 06:33:36 AM
Oh! Nice :-)