Last active
August 29, 2015 13:56
-
-
Save arkiver/9110434 to your computer and use it in GitHub Desktop.
Return the no of elements in a list
This file contains 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 no-of-ele (lst) | |
"Return the no. of elements in a list" | |
(if (endp lst) | |
0 | |
(progn (+ 1 (no-of-ele (rest lst)))) | |
) | |
) | |
;; CL-USER> (no-of-ele '(1 2 3)) | |
;; 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment