PasteRack.org
Paste # 35776
2019-04-11 11:15:51

Fork as a new paste.

Paste viewed 400 times.


Embed:

  1. #lang racket
  2. ;;product : n m -> c
  3. ;; calculate the product of n+1 untill m, m>n
  4. (define (product n m)
  5.   (cond
  6.    [(= n m) 1]
  7.    [else (* m (product n (- m 1)))]))
  8. (product 20 21)
  9. (product 20 39)

=>

21

8384177419658927035269120000