Skip to content

Instantly share code, notes, and snippets.

@hmenn
Created October 15, 2016 13:34
Show Gist options
  • Select an option

  • Save hmenn/eedbc68f9270230f2abb37c47140f2d0 to your computer and use it in GitHub Desktop.

Select an option

Save hmenn/eedbc68f9270230f2abb37c47140f2d0 to your computer and use it in GitHub Desktop.
counts how many of its top-level expressions are atomic expressions
(defun count-atoms (l)
(cond
((endp l) 0)
((symbolp (first l)) (1+ (count-atoms (rest l)))) ; found an atom
(t (count-atoms (rest l))) ; recursive call
))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment