From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?iso-8859-1?Q?Court=E8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: Re: peval error Date: Sun, 11 Sep 2011 01:05:23 +0200 Message-ID: <87d3f8q9qk.fsf@gnu.org> References: <874o0kti4m.fsf@pobox.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1315695936 3962 80.91.229.12 (10 Sep 2011 23:05:36 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 10 Sep 2011 23:05:36 +0000 (UTC) Cc: bug-guile To: Andy Wingo Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Sep 11 01:05:31 2011 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1R2Wc6-0006uJ-On for guile-bugs@m.gmane.org; Sun, 11 Sep 2011 01:05:30 +0200 Original-Received: from localhost ([::1]:53801 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2Wc6-0004kk-5F for guile-bugs@m.gmane.org; Sat, 10 Sep 2011 19:05:30 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:38155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2Wc3-0004kf-Da for bug-guile@gnu.org; Sat, 10 Sep 2011 19:05:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R2Wc2-0000fC-8K for bug-guile@gnu.org; Sat, 10 Sep 2011 19:05:27 -0400 Original-Received: from solo.fdn.fr ([80.67.169.19]:36722) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R2Wc2-0000f8-0m for bug-guile@gnu.org; Sat, 10 Sep 2011 19:05:26 -0400 Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) (using TLSv1 with cipher DHE-RSA-AES128-SHA (128/128 bits)) (Client did not present a certificate) (Authenticated sender: lcourtes) by smtp.fdn.fr (Postfix) with ESMTPSA id 55433441C8; Sun, 11 Sep 2011 01:05:24 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 Fructidor an 219 de la =?iso-8859-1?Q?R=E9volutio?= =?iso-8859-1?Q?n?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu In-Reply-To: <874o0kti4m.fsf@pobox.com> (Andy Wingo's message of "Sat, 10 Sep 2011 10:35:53 -0700") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 80.67.169.19 X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:5827 Archived-At: Hi Andy, Thanks for the report! Andy Wingo 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=E2=80=99ve reduced it to: (letrec ((fold (lambda (f car) (f (car x))))) (fold * (lambda (x) x))) =3D> (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=E2=80=99s see... Ludo=E2=80=99.