Wednesday, December 19, 2007

My First Lisp Program

For the last few days, I'm reading the famous book name "Structure and Interpretation of Computer Programs" by Harold Abelson and Gerald Jay Sussman. The books is available online: Link

This is my first lisp program to compute Factorial:

(define (fact x)
(cond
((= x 1) 1)
((> x 1) (* x (fact (- x 1))))
)
)

No comments: