Skip to content

Instantly share code, notes, and snippets.

@honix
Created June 27, 2017 20:41
Show Gist options
  • Save honix/38072b47dd67fb470f790ff206976918 to your computer and use it in GitHub Desktop.
Save honix/38072b47dd67fb470f790ff206976918 to your computer and use it in GitHub Desktop.
Ninety-Nine Lisp Problems
;; http://www.ic.unicamp.br/~meidanis/courses/mc336/2006s2/funcional/L-99_Ninety-Nine_Lisp_Problems.html
;;
;; trying to use only these sacred symbols
;; (quote, atom, eq, car, cdr, cons and cond)
(defvar s '(a b c d))
(defun my-last (l)
(if (cdr l)
(my-last (cdr l))
l))
(defun my-but-last (l)
(if (cddr l)
(my-but-last (cdr l))
l))
(defun my-nth (l i)
(if (= i 0)
(car l)
(my-nth (cdr l) (- i 1))))
(defun my-length (l)
(if (null l)
0
(+ 1 (my-length (cdr l)))))
(defun my-reverse (l)
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment