From: Shaun Dodimead
Subject: Re: Lisp Question
Date: 
Message-ID: <624u6v$q3u@wapping.ecs.soton.ac.uk>
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.
--
 
From: Barry Margolin
Subject: Re: Lisp Question
Date: 
Message-ID: <626762$rkm@tools.bbnplanet.com>
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.