3 ms·
It's trivial, of course, in Common Lisp: (defun flatten (x) (if (listp x) (reduce #'append (mapcar #'flatten x)) (list x)))
by ScottBurson 10y ago
It's trivial, of course, in Common Lisp:
(defun flatten (x)
(if (listp x)
(reduce #'append (mapcar #'flatten x))
(list x)))