What would be the simplest/quickest method of adding an extra set of brackets to any sublist's within an initial list?
e.g.
(addbrac '(a b c (d e f (g h) i) jk))
--> ((a b c ((d e f ((g h)) i)) jk))
Shaun.
--
In article <··········@wapping.ecs.soton.ac.uk>,
Shaun Dodimead <······@virgo.ecs.soton.ac.uk> wrote:
>What would be the simplest/quickest method of adding an extra set of brackets to any sublist's within an initial list?
>
>e.g.
>
> (addbrac '(a b c (d e f (g h) i) jk))
> --> ((a b c ((d e f ((g h)) i)) jk))
Untested:
(defun addbrac (thing)
(if (atom thing) thing
(list (mapcar #'addbrac thing))))
--
Barry Margolin, ······@bbnplanet.com
GTE Internetworking, Powered by BBN, Cambridge, MA
Support the anti-spam movement; see <http://www.cauce.org/>
Please don't send technical questions directly to me, post them to newsgroups.