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 22:20:39 -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".
> 
> Even emacs itself calls such beasts true lists:

No, it does not.

> (typep '()                   'list) --> t
> (typep '(1)                  'list) --> t
> (typep '(1 . #1=(2 3 . #1#)) 'list) --> t
> (typep '(1 . 2)              'list) --> t

You're apparently grasping at straws.  There is no mention of "true list" there.


The Emacs implementation of `typep' just calls `listp' when you pass it `list',
so of course it returns non-nil for any cons cell or nil.

`typep' does not distinguish "true"/"proper" lists from dotted lists, so it is
useless to appeal to it as an authority on the terminology to use to distinguish
the two.

In any case, `typep' in Emacs is just an emulation of `typep' in Common Lisp,
which refers to Common Lisp types.  `typep' does not (and should not) try to say
anything about Emacs Lisp types.

The Emacs doc uses only "true list" for what you called a "proper list".  It
never uses "proper list" (which is also an OK name for it, IMO).

> >>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".  
> 
> No, f[.] manual, you're dumbing down the language, which is
> patronizing and error inducing.

I have no idea what you mean by that.

You insisted that this be called a "proper list" and not a "true list".  Why?
To me, personally, either of those terms would be appropriate to distinguish a
nil-terminated list from a dotted list (with non-nil last cdr).

The fact is that your correction of "true" to "proper" does not correspond to
the terminology that Emacs itself uses, and it does not add anything to our
understanding.  That's all.  If you want to pick nits then get the nits right or
you just confuse people.

The idea of help-gnu-emacs is to help folks.  If you want to change the
terminology used in the manual, try `M-x report-emacs-bug' or
emacs-devel@gnu.org.




reply via email to

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