Created
March 7, 2011 17:38
-
-
Save daniel-cussen/858853 to your computer and use it in GitHub Desktop.
#'flatten
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun flatten (x) | |
(labels ((rec (x acc) | |
(cond ((null x) acc) | |
((atom x) (cons x acc)) | |
((null (car x)) (cons nil (rec (cdr x) acc))) | |
(t (rec (car x) (rec (cdr x) acc)))))) | |
(rec x nil))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment