Eduardo Cavazos wrote:

(define fib
  (binrec (less-than= 1)
          (constant 1)
          (sub 1)
          (sub 2)
          +))

By the way, if you make a binary+ it's faster:

(define (add-two x y)
  (+ x y))

(define fib
  (binrec (less-than= 1)
          (constant 1)
          (sub 1)
          (sub 2)
          add-two))

I was surprised by this. It seems that the compiler would notice that you're eventually passing two things to the original '+' so it should do just as good.

Ed

Reply via email to