From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.devel Subject: Re: %nil once again Date: Thu, 23 Jul 2009 22:35:20 +0200 Message-ID: References: <4A5F2F8A.5040108@domob.eu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1248382051 31678 80.91.229.12 (23 Jul 2009 20:47:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 23 Jul 2009 20:47:31 +0000 (UTC) Cc: Neil Jerram , guile-devel To: Daniel Kraft Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Thu Jul 23 22:47:23 2009 Return-path: Envelope-to: guile-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MU5CE-0006at-2j for guile-devel@m.gmane.org; Thu, 23 Jul 2009 22:47:22 +0200 Original-Received: from localhost ([127.0.0.1]:37513 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5CD-0004Kh-GK for guile-devel@m.gmane.org; Thu, 23 Jul 2009 16:47:21 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MU5C9-0004Gx-Li for guile-devel@gnu.org; Thu, 23 Jul 2009 16:47:17 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MU5C3-00047o-Vv for guile-devel@gnu.org; Thu, 23 Jul 2009 16:47:16 -0400 Original-Received: from [199.232.76.173] (port=52831 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MU5C3-00047W-Dw for guile-devel@gnu.org; Thu, 23 Jul 2009 16:47:11 -0400 Original-Received: from a-pb-sasl-sd.pobox.com ([64.74.157.62]:64544 helo=sasl.smtp.pobox.com) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MU5C2-000667-WF for guile-devel@gnu.org; Thu, 23 Jul 2009 16:47:11 -0400 Original-Received: from localhost.localdomain (unknown [127.0.0.1]) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTP id 9C6B1F6B7; Thu, 23 Jul 2009 16:47:10 -0400 (EDT) Original-Received: from unquote (unknown [81.38.186.175]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-sd.pobox.com (Postfix) with ESMTPSA id 5593AF6B6; Thu, 23 Jul 2009 16:47:06 -0400 (EDT) In-Reply-To: <4A5F2F8A.5040108@domob.eu> (Daniel Kraft's message of "Thu, 16 Jul 2009 15:47:54 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.92 (gnu/linux) X-Pobox-Relay-ID: FE49F4C4-77C9-11DE-9857-AEF1826986A2-02397024!a-pb-sasl-sd.pobox.com X-detected-operating-system: by monty-python.gnu.org: Solaris 10 (beta) 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:8926 Archived-At: Hi Daniel! Reviewing (and merging as much as possible of) your elisp branch is my next Guile task, after taking care of that bug recently reported by Martin Ward. Should be short work at this point. This is a little late, but fwiw... On Thu 16 Jul 2009 15:47, Daniel Kraft writes: > I think I got the test-suite as well as a basic macro implementation Awesome! > scheme@(guile-user)> `(1 2 3 . ,%nil) > (1 2 3) > > (is %nil in Scheme a variable because it needs the unquote?) Scheme's end-of-list has the read syntax `()'. Elisp's nil has no read syntax, to Scheme. If you want to get it in Scheme, you have to do so via a variable. > scheme@(guile-user)> (null? %nil) > #f This is a bug with the VM. > scheme@(guile-user)> (equal? %nil (cdr (list 1))) > #f Hmmmmmmm. It's not clear that nil and null are equal?. Probably they should be. Should they be eqv ? I wonder. > It would be cool to teach Guile somehow to treat %nil as the "standard" > end-of-list value, such that both of these queries would optimally > return true. No, they need to be different. Otherwise (if (cdr '(a)) 'b 'c) would give 'c, not 'b. > At least, is there some way to construct lists terminated by %nil > using something like the list primitive? It would need to be something you implement as part of the emacs runtime. Otoh, (cons* a b c %nil) will do what you want. > Other things needed would be for instance terminating rest-arguments > by %nil rather than '() and the like. Hmmmmm. This is a good question. I think that, on the bytecode side, you would have to receive the normal Scheme rest argument, then run through it and replace the terminating '() with %nil. So when compiling functions that take rest args, they'd have this operation as one of their first instructions. There could be a VM op for this if necessary. > So: How is this handled by the interpreter? Is there maybe some > runtime-option to make Guile use %nil as end-of-list for lists > constructed? Or could we introduce some means to do so? > > If that's not a good idea because of performance or other > considerations, I guess I'll have to implement some conversion routine > and use that? This on the other hand will probably hit Elisp's > performance. Yes it's probably a good idea to implement this conversion routine, for now at least. On the other other hand... can we enumerate the set of circumstances in which we'd want to change a Scheme list to an Elisp list? Call, obviously. Probably we want to support tail recursion in calls within elisp, so tail calls too. Reading, but the elisp reader has to be slightly different anyway. If it's only calls, we can do tricks in the VM to make things faster. But for now, just compile in a call to a runtime conversion. Cheers, Andy -- http://wingolog.org/