[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Kawa-commonlisp-dev] Switching to Guile's #nil
From: |
John Cowan |
Subject: |
Re: [Kawa-commonlisp-dev] Switching to Guile's #nil |
Date: |
Fri, 21 Jun 2013 03:57:49 -0400 |
User-agent: |
Mutt/1.5.20 (2009-06-14) |
Per Bothner scripsit:
> Apropos here a a related note from John Rose:
> http://mail.openjdk.java.net/pipermail/lambda-dev/2013-June/010171.html
[snip]
> This seems hard to avoid with the "Guile approach": Unless you know
> a list is a "Scheme list" then you have to test for both LList.Empty
> and #!null.
>
> Code that does:
> (eq? lst '())
> will be faster than
> (null? lst)
> but the latter also handles Lisp lists. Is that a good tradeoff?
Based on the above-referenced note, perhaps it is not actually faster,
given that a null check can often be folded in. (Smalltalk has two
separate subclasses of Boolean, namely True and False -- both singleton
classes, but that's neither here nor there -- and it's perhaps a pity
that Java didn't do the same.)
> One could make "better Scheme/Lisp compatibility" a configuration
> option. Not clear what the default should be. Of course one
> might argue that interpreting #!null as false and allowing it as the
> end-of-list are "friendlier" and less surprising, even to pure Scheme
> programmers.
Indeed, and I think it should be the default for that reason. If
it turns out that (eq? x '()) is actually faster, then it can be
added to the performance hints.
--
Is a chair finely made tragic or comic? Is the John Cowan
portrait of Mona Lisa good if I desire to see address@hidden
it? Is the bust of Sir Philip Crampton lyrical, http://ccil.org/~cowan
epical or dramatic? If a man hacking in fury
at a block of wood make there an image of a cow,
is that image a work of art? If not, why not? --Stephen Dedalus