guile-devel
[Top][All Lists]
Advanced

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

Re: %nil once again


From: Daniel Kraft
Subject: Re: %nil once again
Date: Fri, 17 Jul 2009 11:02:46 +0200
User-agent: Thunderbird 2.0.0.0 (X11/20070425)

Hi Neil,

Neil Jerram wrote:
Daniel Kraft <address@hidden> writes:
I think I got the test-suite as well as a basic macro implementation
(the compiler framework is really cool, that was fairly easy to do);
recursive macros do not yet work, but otherwise it looks fine.

However, I want to tackle quasi-quotes (besides others) now; and in
Elisp %nil is not only #f of Scheme but also the end-of-list marker (I
guess that's why simply using Scheme's #f for %nil does not work).

I did some experiments, and it seems that Scheme respects it partially:

scheme@(guile-user)> `(1 2 3 . ,%nil)
(1 2 3)

(is %nil in Scheme a variable because it needs the unquote?)

Do you mean why don't we just use the symbol nil?  If so, the answer
is because in Scheme, (cons 'a 'nil) should be (a . nil), not (a).

No, I mean why '(1 2 3 . %nil) does yield (1 2 3 . %nil) while `(1 2 3 . ,%nil) gives the expected (1 2 3). But that does not matter much besides astonishing me, as this is only something related to the Scheme implementation of %nil, I guess.

However:

scheme@(guile-user)> (null? %nil)
#f
scheme@(guile-user)> (equal? %nil (cdr (list 1)))
#f

I believe those work in the interpreter, and so are VM bugs.  Can you
check that with ,o interp #t ?

The first one is indeed #t with the interpreter, the second one not. But unfortunatly I think that the elisp equivalent of

(equal?/eqv?/eq? (cdr (list 1)) nil)

(don't know which predicates take the place of eq?/eqv?/equal? in elisp yet) should indeed yield true, as a perfectly valid way to check for (null? (cdr (list 1))), right? So it seems that in this case even the Guile interpreter does not handle empty lists as it should for elisp -- or don't we need to ensure that test is true?

 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.

Any suggestions and ideas welcome!  Maybe I just fail to see something...

Just a couple of VM bugs, I think...

Hm, ok, so if the one thing above is resolved (or can be ignored) I can without any problems just use Guile's primitive list and co. and take created lists as valid for Elisp, as long as those bug get fixed (maybe with the pending patch)? So no need for ensuring myself that all '()'s get replaced by %nil's?

Daniel

--
Done:  Arc-Bar-Cav-Ran-Rog-Sam-Tou-Val-Wiz
To go: Hea-Kni-Mon-Pri




reply via email to

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