Advertisement
Guest User

Untitled

a guest
Mar 18th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lisp 0.48 KB | None | 0 0
  1. (labels ((mapatoms (function tree)
  2.            (cond
  3.              ((atom tree)
  4.               (funcall function tree))
  5.              ((consp tree)
  6.               (cons (mapatoms function (car tree))
  7.                     (mapatoms function (cdr tree)))))))
  8.   (mapatoms (lambda (atom)
  9.               (format t "~A~%" atom))
  10.             '(defmacro (x) `(list ,x))))
  11. ;; output:
  12. ;; DEFMACRO
  13. ;; X
  14. ;; NIL
  15. ;; QUASIQUOTE
  16. ;; LIST
  17. ;; ,X
  18. ;; NIL
  19. ;; NIL
  20. ;; NIL
  21. ;; (NIL (NIL) (NIL (NIL NIL)))
  22. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement