Created
March 26, 2013 05:40
-
-
Save maddievision/5243396 to your computer and use it in GitHub Desktop.
more fantasy land
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
LISP | |
(defun lazy-mapcan (fun lst) | |
(labels ((f (lst-cur) | |
(if (lazy-null lst-cur) | |
(force (lazy-mapcan fun (lazy-cdr lst))) | |
(cons (lazy-car lst-cur) (lazy (f (lazy-cdr lst-cur))))))) | |
(lazy (unless (lazy-null lst) | |
(f (funcall fun (lazy-car lst))))))) | |
1 (semi-compact) | |
defun | |
lazy-mapcan | |
fun lst | |
labels | |
f | |
lst-cur | |
if | |
lazy-null lst-cur | |
force (lazy-mapcan fun (lazy-cdr lst)) | |
lazy | |
unless (lazy-null lst) | |
f (funcall fun (lazy-car lst)) | |
2 (expanded) | |
defun | |
lazy-mapcan | |
fun lst | |
labels | |
f | |
lst-cur | |
if | |
lazy-null lst-cur | |
force | |
lazy-mapcan | |
fun | |
lazy-cdr lst | |
lazy | |
unless | |
lazy-null lst | |
f | |
funcall | |
fun | |
lazy-car lst |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment