[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
delistifying lists...
- To: info-macl@cambridge.apple.com
- Subject: delistifying lists...
- From: Luke Hohmann <hohmann@csmil.umich.edu>
- Date: Mon, 17 Aug 92 07:49:04 -0400
I needed a function to "delistofy" lists. Here is the function I wrote
and some sample runs. My question to you is: can you submit a faster/better/
cleaner/more robust version of this function? THANKS!
? (defun delistify (l)
(cond ((null l) nil)
((atom l) l)
((listp (car l))
(delistify (append (car l) (cdr l))))
(t
(cons (delistify (car l))
(delistify (cdr l))))))
delistify
? (delistify '(1 2 3))
(1 2 3)
? (delistify '((1 2 3) 4 5 6))
(1 2 3 4 5 6)
? (delistify '(1 2 3 (4 5 6)))
(1 2 3 4 5 6)
? (delistify '((1 2 3) 4 5 6 ((7 8 9))))
(1 2 3 4 5 6 7 8 9)
?
-- Luke