Abdulaziz Ghuloum wrote:
Change it to:
(define (fib x)
((ifte (less-than= 1)
(constant 1)
(bi (uni (sub 1) fib)
(uni (sub 2) fib) +))
x))
Eduardo Cavazos wrote:
In idiomatic FP code, there are no named parameters.
So I guess the way out is a macro. Going with your suggestion:
(define-syntax define-recursive
(syntax-rules ()
((define-recursive name val)
(define (name x)
(val x)))))
Looks good now:
(define-recursive fib
(ifte (less-than= 1)
(constant 1)
(bi (uni (sub 1) fib)
(uni (sub 2) fib) +)))
Ed