[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

DEFINE



Consider the following sequence of T input:

(define (add-two a b)
  (if (zero? a)
      b
      (add-two (-1+ a) (1+ b))))

(define adder add-two)

(define (add-two a) (+ 2 a))

(adder 2 3) => error!

This does not seem right.

Instead of expanding define as:
(define (name . args) . body) ==>
  (define name (lambda args . body))

I suggest:
(define (name . args) . body) ==>
  (define name
     (labels ((name (lambda args . body)))
       (name . args))).

This would make define-integrable work.
John