| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
6.23.2.1 Nil
nil in ELisp is an amalgam of Scheme’s #f and '().
It is false, and it is the end-of-list; thus it is a boolean, and a list
as well.
Guile has chosen to support nil as a separate value, distinct
from #f and '(). This allows existing Scheme and Elisp
code to maintain their current semantics. nil, which in Elisp
would just be written and read as nil, in Scheme has the external
representation #nil.
This decision to have nil as a low-level distinct value
facilitates interoperability between the two languages. Guile has chosen
to have Scheme deal with nil as follows:
(boolean? #nil) ⇒ #t (not #nil) ⇒ #t (null? #nil) ⇒ #t
And in C, one has:
scm_is_bool (SCM_ELISP_NIL) ⇒ 1 scm_is_false (SCM_ELISP_NIL) ⇒ 1 scm_is_null (SCM_ELISP_NIL) ⇒ 1
In this way, a version of fold written in Scheme can correctly
fold a function written in Elisp (or in fact any other language) over a
nil-terminated list, as Elisp makes. The converse holds as well; a
version of fold written in Elisp can fold over a
'()-terminated list, as made by Scheme.
On a low level, the bit representations for #f, #t,
nil, and '() are made in such a way that they differ by
only one bit, and so a test for, for example, #f-or-nil
may be made very efficiently. See libguile/boolean.h, for more
information.
| [ << ] | [ < ] | [ Up ] | [ > ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
This document was generated on April 20, 2013 using texi2html 5.0.
