On Tue, 2009-10-20 at 05:47 -0700, jhaase wrote:
> I have a version that passes the recursion, equality and mutual
> recursion test
Can your version handle this?:
(let ()
(define-integrable (even? n) (or (zero? n) (m-odd? (- n 1))))
(define-integrable (odd? n) (not (m-even? n)))
(define-syntax m-odd? (syntax-rules () ((_ x) (odd? x))))
(define-syntax m-even? (syntax-rules () ((_ x) (even? x))))
(even? 5))
Meaning, can it handle recursive uses which result from later expansion
and are not knowable from the syntax given to the macro transformers
defined by define-integrable? If so, don't show us yet :)
> but fails on this one:
>
> (let ()
> (define-integrable (fact n)
> (let ((residual-fact (lambda (x) (error 'fact "captured residual-
> fact"))))
> (if (< n 2)
> 1
> (* n (fact (- n 1))))))
> (display (fact 5))) ;;; => 120 but displays the error message
> instead
>
> The tspl version also breaks on this, but can easily be repaired (and
> shortened) by removing make-residual-name
With Petite 7.9.3, and using the definition of define-integrable from
TSPL 3 [1], I do not get your error message when evaluating your above
code (slightly modified to (define-integrable fact (lambda (n) ---))),
i.e. the TSPL version is not breaking on that.
I do agree define-integrable should not unhygienically introduce the
binding for residual-whatever. I don't know why the TSPL version does
that.
[1] http://www.scheme.com/tspl3/syntax.html
--
: Derick
----------------------------------------------------------------