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))))))

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