help-gnu-emacs
[Top][All Lists]
Advanced

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

RE: 'length' function for lists and cons cells?


From: Drew Adams
Subject: RE: 'length' function for lists and cons cells?
Date: Sat, 23 Mar 2013 08:35:24 -0700

> > So if both, true lists and cons cells, are processed in a... 
> 
> proper-lists, not true lists.  
> They all are true lists, ie. cons cells or nil.

Maybe for some people.  For others, "true list" and "proper list" mean the same
thing.  FWIW, Emacs itself calls such a beast a "true list".

>From (elisp) `Cons Cells':

  Also by convention, the CDR of the last cons cell in a
  list is `nil'.  We call such a `nil'-terminated structure
  a "true list".  In Emacs Lisp, the symbol `nil' is both
  a symbol and a list with no elements.  For convenience,
  the symbol `nil' is considered to have `nil' as its CDR
  (and also as its CAR).

  Hence, the CDR of a true list is always a true list.
  The CDR of a nonempty true list is a true list containing
  all the elements except the first.

  If the CDR of a list's last cons cell is some value
  other than `nil', we call the structure a "dotted list"...

In any case, it is the description/meaning that is most important, not the name,
and there we agree.




reply via email to

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