Baby steps
My first pathetic program in lisp:
(defun fib (x)
(if (and (not (equal x 1)) (not (equal x 0)))
(+ (fib (- x 1)) (fib (- x 2))) 1))
Try not to be too intimidated by the complexity or sheer or power of it.
My first pathetic program in lisp:
(defun fib (x)
(if (and (not (equal x 1)) (not (equal x 0)))
(+ (fib (- x 1)) (fib (- x 2))) 1))
Try not to be too intimidated by the complexity or sheer or power of it.
3 Comments
(defun fib (x) (if (and (not (equal x 1)) (not (equal x 0))) (+ (fib (- x 1)) (fib (- x 2))) 1))Ahh ... that was supposed to be properly formatted. :) Sorry ..
Sorry. I wrapped it in pre tags for you. I must admit, properly formatting Lisp seems confusing. There was a half chapter on how to indent things, in Practical Common Lisp. Everything in Lisp seems entirely different from every other language I've ever studied, right down to formatting.
Speak your Mind
Preview