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: Thu, 15 Sep 2011 23:44:19 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux)

Hi Andy!

Andy Wingo <address@hidden> skribis:

> Hi Ludo,
>
> On Tue 13 Sep 2011 10:04, address@hidden (Ludovic Courtès) writes:
>
>> Andy Wingo <address@hidden> skribis:
>>
>>> I'm excited about the partial evaluator.
>
> I'm still excited about it!

Thanks for persevering!  :-)

>>>   (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))))
>>>
>> I believe this is now fixed:
>
> Unfortunately it is not yet fixed.  The free variable `x' ends up as a
> lexical ref, but without a binding.  Try it and see :)

Indeed.

This time peval uses variables that are in scope.

Apparently the problem stems from the fact that it uses the same gensyms
in different places, which breaks the assumption behind
‘vars->bind-list’, as shown with this excerpt of partial evaluation of
your expression:

  (apply (primitive *)
         (apply (lambda ()
                  (lambda-case
                    (((x1) #f #f #f () (#{x1 85196}#)) ;; 1st occurrence
                     (lexical x1 #{x1 85196}#))))
                (toplevel x))
         (apply (lexical fold #{fold 85183}#)

                [...]

                (const 1)
                (primitive zero?)
                (lambda ()
                  (lambda-case
                    (((x1) #f #f #f () (#{x1 85196}#)) ;; 2nd occurrence
                     (lexical x1 #{x1 85196}#))))

                [...]

I guess peval should do some further renaming upon inlining.

WDYT?

Thanks,
Ludo’.



reply via email to

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