Advertisement
Guest User

Untitled

a guest
Jun 13th, 2019
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1.  
  2. (defmacro named-let (name bindings &body body)
  3. `(labels ((,name ,(mapcar (lambda (x) (if (listp x) (first x) x)) bindings)
  4. ,@body))
  5. (,name ,@(mapcar (lambda (x) (if (listp x) (second x) nil)) bindings))))
  6.  
  7. ;; (named-let fact ((n 10))
  8. ;; (if (< n 1) 1 (* n (fact (1- n)))))
  9. ;; --> 3628800
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement