On Oct 20, 7:54 pm, Derick Eddington <[email protected]>
wrote:
> 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 :)

The more I think about this the stronger my feeling gets that it can't
be done. What is missing for me is the following procedure:

(syntax-expand-1 id stx) procedure
syntax-expand1 expands the syntax stx once in the context of the
identifier id.

This would give us the possibility to check for infinite expansion
loops. With syntax-expand-1 we could also build the following
predicate:

(syntax-expanded? id stx) procedure
syntax-expanded? returns #t if the syntax given by stx is fully
expanded in the context of the identifier id. It returns #f otherwise.

I think one of these would suffice to make the whole thing work.

While fooling around, I found another test, that works for "define"
but not for "define-integrable" (also with fluid-let-syntax):

(let ()
  (define-integrable (fact n)
    (define-syntax dummy (syntax-rules () ((_ args ...) #'#t)))
    (if (< n 2)
        1
        (* n (fact (- n 1)))))
  (prn (fact 5))) ;;; => 120

This results in a syntax error "extra ellipsis in syntax form".

As I'm running out of ideas for "define-integrable", I think I will
check out the "with-quote" problem ;)

Greetings,
Juergen

Reply via email to