Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Writing Factorials in LISP

Name: Anonymous 2010-10-21 19:24

Your damn unreadable one liners.

If you disagree without a doubt I then won't even partially trying to conceive of a better fixable situation the more time it takes.

Name: Anonymous 2010-10-23 1:32

(define (factorial x) ; Calculate x!
  (if (zero? x) 1     ; 0! = 1
      (calc-fact x))) ; otherwise

(define (calc-fact x) ; x -> x(x-1)!
  (* x (factorial (- x 1))))

(factorial 5)


Unreadable? One-liners?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List