From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.devel Subject: Re: Commercial development Date: Sun, 12 Jun 2005 10:38:53 +0100 Message-ID: <42AC02AD.1030405@ossau.uklinux.net> References: <115t7ajdbfq8348@corp.supernews.com> <871x966hwn.fsf@naia.workingwithlinux.com> <426505c8$0$196$edfadb0f@dread12.news.tele.dk> <426601FF.6010600@ossau.uklinux.net> <9qGdnYkVut1t0PvfRVn-rw@giganews.com> <4266AB46.2050107@ossau.uklinux.net> <4266AC41.4050105@ossau.uklinux.net> <87zmu4k03x.fsf@zagadka.de> <42A619D7.3040703@ossau.uklinux.net> <42A740F5.90400@ossau.uklinux.net> <87fyvohasz.fsf@zagadka.de> <42ABE4A4.8090503@ossau.uklinux.net> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------010509070801070701090900" X-Trace: sea.gmane.org 1118570460 24947 80.91.229.2 (12 Jun 2005 10:01:00 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 12 Jun 2005 10:01:00 +0000 (UTC) Cc: guile-devel , Marius Vollmer Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Sun Jun 12 12:00:58 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DhPGx-0006g8-0E for guile-devel@m.gmane.org; Sun, 12 Jun 2005 12:00:55 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DhPLV-0008SY-KO for guile-devel@m.gmane.org; Sun, 12 Jun 2005 06:05:37 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DhP7l-0002kq-3c for guile-devel@gnu.org; Sun, 12 Jun 2005 05:51:26 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DhP7h-0002if-Li for guile-devel@gnu.org; Sun, 12 Jun 2005 05:51:22 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DhP7e-0002Zv-19 for guile-devel@gnu.org; Sun, 12 Jun 2005 05:51:18 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DhOwo-0000lF-Ug for guile-devel@gnu.org; Sun, 12 Jun 2005 05:40:07 -0400 Original-Received: from laruns (host81-130-111-97.in-addr.btopenworld.com [81.130.111.97]) by mail3.uklinux.net (Postfix) with ESMTP id D3B1B409FA7; Sun, 12 Jun 2005 09:39:16 +0000 (UTC) Original-Received: from [127.0.0.1] (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 11F9A9F119; Sun, 12 Jun 2005 10:38:54 +0100 (BST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.8) Gecko/20050513 Debian/1.7.8-1 X-Accept-Language: en Original-To: Neil Jerram In-Reply-To: <42ABE4A4.8090503@ossau.uklinux.net> X-Enigmail-Version: 0.91.0.0 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.devel:5103 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:5103 This is a multi-part message in MIME format. --------------010509070801070701090900 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Neil Jerram wrote: > > Yes, I'll have a go. How about the attached? The scm_reverse_x is annoying, but removing it would require - either modifying transform_bindings etc. so as not to reverse things in the first place, or so as to reverse the init vars in the same way as the init forms - or constructing the list backwards in eval_letrec_inits - but I can't see a way of doing that. Neil --------------010509070801070701090900 Content-Type: text/x-patch; name="eval.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="eval.c.diff" Index: eval.c =================================================================== RCS file: /cvsroot/guile/guile/guile-core/libguile/eval.c,v retrieving revision 1.397 diff -u -r1.397 eval.c --- eval.c 6 Jun 2005 18:49:55 -0000 1.397 +++ eval.c 12 Jun 2005 09:30:14 -0000 @@ -96,6 +96,7 @@ static SCM canonicalize_define (SCM expr); static SCM *scm_lookupcar1 (SCM vloc, SCM genv, int check); static SCM unmemoize_builtin_macro (SCM expr, SCM env); +static SCM eval_letrec_inits (SCM env, SCM init_forms, SCM init_values); @@ -3148,6 +3149,29 @@ return *results; } +static SCM +eval_letrec_inits (SCM env, SCM init_forms, SCM init_values) +{ + SCM argv[10]; + int i = 0, imax = sizeof (argv) / sizeof (SCM); + + while (!scm_is_null (init_forms)) + { + if (imax == i) + { + init_values = eval_letrec_inits (env, init_forms, init_values); + break; + } + argv[i++] = EVALCAR (init_forms, env); + init_forms = SCM_CDR (init_forms); + } + + for (i--; i >= 0; i--) + init_values = scm_cons (argv[i], init_values); + + return init_values; +} + #endif /* !DEVAL */ @@ -3563,21 +3587,9 @@ x = SCM_CDR (x); { SCM init_forms = SCM_CAR (x); - SCM init_values = SCM_EOL; - do - { - init_values = scm_cons (EVALCAR (init_forms, env), init_values); - init_forms = SCM_CDR (init_forms); - } - while (!scm_is_null (init_forms)); - - /* In order to make case 1.1 of the R5RS pitfall testsuite - succeed, we would need to copy init_values here like - so: - - init_values = scm_list_copy (init_values); - */ - SCM_SETCDR (SCM_CAR (env), init_values); + SCM init_values = eval_letrec_inits (env, init_forms, SCM_EOL); + SCM_SETCDR (SCM_CAR (env), + scm_reverse_x (init_values, SCM_UNDEFINED)); } x = SCM_CDR (x); PREP_APPLY (SCM_UNDEFINED, SCM_EOL); --------------010509070801070701090900 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://lists.gnu.org/mailman/listinfo/guile-devel --------------010509070801070701090900--