PasteRack.org
Paste # 35282
2019-04-11 11:15:25

Fork as a new paste.

Paste viewed 176 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)

=>

m-1: undefined;

 cannot reference an identifier before its definition

  in module: 'm

m-1: undefined;

 cannot reference an identifier before its definition

  in module: 'm