Subject: Re: Mapcar'ing after splitting a list
From: rpw3@rpw3.org (Rob Warnock)
Date: Thu, 27 Mar 2008 03:44:13 -0500
Newsgroups: comp.lang.lisp
Message-ID: <YuCdnf3MWaHAw3banZ2dnUVZ_tHinZ2d@speakeasy.net>
John Thingstad <jpthing@online.no> wrote:
+---------------
| This one is considerably less ugly..
| (defmacro add(list) `(apply #'mapcar #'+ ,list))
| (add '((1 2 3) (4 5 6)))
| (5 7 9)
+---------------

That reminds me of the ancient well-known hack for transposing a matrix
represented as a list of liists:

    > (apply #'mapcar #'list '((1 2 3) (4 5 6) (7 8 9) (10 11 12)))

    ((1 4 7 10) (2 5 8 11) (3 6 9 12))
    > 


-Rob

-----
Rob Warnock			<rpw3@rpw3.org>
627 26th Avenue			<URL:http://rpw3.org/>
San Mateo, CA 94403		(650)572-2607