On Sun, Apr 25, 2010 at 10:15:16AM +0200, Jon Kleiser wrote:
> > : (list)
> > -> (NIL)
> >
> > That's fine, ...
> Or is it? Why doesn't (list) evaluate to the same as () ?

This is a matter on how 'list' is defined. We had some time ago a
similar discussion with 'on' and 'off', I think.

Many functions which expect at least one argument take "no argument" as
NIL. This is consistent with other situations where (optional)
non-supplied arguments are handled as 'NIL'.

And it is a matter of efficiency, if the interpreter doesn't have to
check if there is really an argument or not. Pure pragmatism ;-)

A better example for that might be 'cons'. It is supposed to create a
new cell. 'cons' is the basic cell-building function. So the call might

   (cons NIL NIL)

This is, however, equivalent (and consistent) with

   (cons NIL)

or even just


This is short and practical. I never write (cons NIL NIL) when I want to
create an empty call, but always (cons).

To be true, in case of 'list' this doesn't make much sense, but still
(list) might be called to create a single empty cell.

- Alex
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to