[ prog / sol / mona ]

prog


Internal definitions vs letrec

4 2020-08-01 22:08

>>1
I prefer named lets when they are applicable, and internal defines over letrec as in the following block:

(define (fibonacci n)
  (let fib-iter ((n n) (a 1) (b 0))
    (if (zero? n)
        b
        (fib-iter (- n 1) (+ a b) a))))
13


VIP:

do not edit these