Created
October 15, 2016 13:34
-
-
Save hmenn/eedbc68f9270230f2abb37c47140f2d0 to your computer and use it in GitHub Desktop.
counts how many of its top-level expressions are atomic expressions
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 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