Last active
August 29, 2015 13:56
-
-
Save arkiver/9092075 to your computer and use it in GitHub Desktop.
Purely recursive funtion to fetch nth element of 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 elek (lst n) | |
(if (= n 0) | |
(progn | |
(car lst)) | |
(elek (rest lst) (- n 1)) | |
) | |
) | |
;; CL-USER> (elek '(1 2 3 4) 2) | |
;; 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment