bug-guile
[Top][All Lists]
Advanced

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

Re: peval error


From: Ludovic Courtès
Subject: Re: peval error
Date: Sun, 11 Sep 2011 01:05:23 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi Andy,

Thanks for the report!

Andy Wingo <address@hidden> skribis:

> I'm excited about the partial evaluator.  However there is one error
> I've found:
>
>   (letrec ((fold (lambda (f x b null? car cdr)
>                    (if (null? x)
>                        b
>                        (f (car x) (fold f (cdr x) b null? car cdr))))))
>     (fold * x 1 zero? (lambda (x) x) (lambda (x) (- x 1))))
>
> The expansion ends up with the body including lexical-refs to `car' and
> `cdr', but they aren't bound in the letrec body.

Ouch.  I’ve reduced it to:

  (letrec ((fold (lambda (f car) (f (car x)))))
    (fold * (lambda (x) x)))

  =>

  (letrec (fold)
    (#{fold 151247}#)
    ((lambda ((name . fold))
       (lambda-case
         (((f car)
           #f
           #f
           #f
           ()
           (#{f 151248}# #{car 151249}#))
          (apply (lexical f #{f 151248}#)
                 (apply (lexical car #{car 151249}#) (toplevel x)))))))
    (apply (primitive *)
           (apply (lexical car #{car 151249}#) (toplevel x))))

Let’s see...

Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]