[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

delistifying lists...



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