Skip to content

Instantly share code, notes, and snippets.

@arkiver
Last active August 29, 2015 13:56
Show Gist options
  • Save arkiver/9110434 to your computer and use it in GitHub Desktop.
Save arkiver/9110434 to your computer and use it in GitHub Desktop.
Return the no of elements in a list
(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