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

n C r

Name: Anonymous 2009-05-24 17:51

(define combination
  (λ(n k)
    (let ((stalled-factorial
           (λ(N stop-value)
             (define iter-sf
               (λ(accum N stop-value)
                 (if (= N stop-value)
                     accum
                     (iter-sf (* accum N) (- N 1) stop-value))))
             (iter-sf 1 N stop-value))))
      (if (> k (- n k))
          (/ (stalled-factorial n k) (factorial (- n k)))
          (/ (stalled-factorial n (- n k)) (factorial k))))))

Name: Anonymous 2009-05-24 20:05

Is it just me, or does LISP make everything 10x longer and harder to write? And you're telling me this is the language which the almighty programmers use? Please, don't make me laugh.

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