Eduardo Cavazos wrote:

(define fib
  (ifte (less-than= 1)
        (constant 1)
        (bi (uni (sub 1) (lambda (x) (fib x)))
            (uni (sub 2) (lambda (x) (fib x))) +)))

By the way, it would be nice if it looked like this:

(define fib
  (ifte (less-than= 1)
        (constant 1)
        (bi (uni (sub 1) fib)
            (uni (sub 2) fib) +)))

I.e. without the lambdas used for quoting the recursive fibs. But of course, this version triggers an error because 'fib' doesn't exist at definition time.

Any suggestions for this?

One thing is to have a "quote function" syntax:

(define-syntax qf
  (syntax-rules ()
    ((qf f)
     (lambda (x)
       (f x)))))

So it helps the appearance a bit:

(define fib
  (ifte (less-than= 1)
        (constant 1)
        (bi (uni (sub 1) (qf fib))
            (uni (sub 2) (qf fib)) +)))

Maybe I should have a special 'define' which handles this style.

Ed

Reply via email to