Path: utzoo!utgpu!water!watmath!clyde!rutgers!sri-spam!sri-unix!quintus!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!its63b!aiva!jeff From: jeff@aiva.ed.ac.uk (Jeff Dalton) Newsgroups: comp.lang.lisp Subject: Re: CL question - conditional list elements Message-ID: <243@aiva.ed.ac.uk> Date: 28 Jan 88 13:22:41 GMT References: <1350005@otter.HP.COM> Reply-To: jeff@uk.ac.ed.aiva (Jeff Dalton) Organization: Dept. of AI, Univ. of Edinburgh, UK Lines: 28 In article <1350005@otter.HP.COM> kers@otter.HP.COM (Christopher Dollin) writes: >Another question about idimatic and efficient code in CL. > >Suppose I wish to constrauct a list with conditional components, that is, >components that may or may not be absent. As far as I can see, the only advantage to the Pop solution is a somewhat nicer notation. In Lisp, you may end up writing out some code that does what you want instead. But the code isn't particularly bad. Saying "it doesn't look too efficient (or nice to write!)" is just saying "I like Pop's syntactic sugar better than unsweetened Lisp." Nothing wrong with that, but one may reasonably disagree. ---------------------------------------------------------------------- I thought you'd never ask. `( ... boring bits ... [note: the elements, not a list thereof] ,@(if Condition1 (list Bit1)) ... more boring bits ... ,@(if Condition2 (list Bit2)) ... final boring bits ... ) ---------------------------------------------------------------------- Jeff Dalton, JANET: J.Dalton@uk.ac.ed AI Applications Institute, ARPA: J.Dalton%uk.ac.ed@nss.cs.ucl.ac.uk Edinburgh University. UUCP: ...!ukc!ed.ac.uk!J.Dalton