[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Predicate for true lists
From: |
Drew Adams |
Subject: |
RE: Predicate for true lists |
Date: |
Fri, 6 Jul 2018 10:00:34 -0700 (PDT) |
1. Why is "proper" better than "true"? I don't argue
against "proper", but what is really gained by this
change in Emacs terminology?
Dunno how helpful this is (perhaps not very), but it
purportedly shows how often "proper" and "true" appear
in print as modifiers of "list" recently:
https://books.google.com/ngrams/graph?content=list%3D%3Eproper%2Clist%3D%3Etrue&case_insensitive=on&year_start=2000&year_end=2018&corpus=15&smoothing=0&share=&direct_url=t4%3B%2Clist%3D%3Eproper%3B%2Cc0%3B%2Cs0%3B%3Blist%3D%3Eproper%3B%2Cc0%3B%3BList%3D%3Eproper%3B%2Cc0%3B.t4%3B%2Clist%3D%3Etrue%3B%2Cc0%3B%2Cs0%3B%3Blist%3D%3Etrue%3B%2Cc0%3B%3Blist%3D%3ETrue%3B%2Cc0%3B%3BList%3D%3ETrue%3B%2Cc0%3B%3BList%3D%3Etrue%3B%2Cc0
They both are rare, and there doesn't seem to be much
difference in their frequencies. If anything, "true list"
is more used. (But this is not based only on mathematical
texts - it just counts books in print.)
2. You say this in the doc string of `proper-list-length':
A proper list is neither circular nor dotted (i.e., its
last cdr is nil).
And your entry in the manual for that function:
In addition to satisfying @code{listp}, a proper list is
neither circular nor dotted.
Fair enough, but it depends on what is meant by a "circular"
list. Does it mean only a list whose last cdr shares list
structure with some other of its cdr's? If so then what you
say holds. And yes, I guess that's what most of us think of.
But what of a list that has a finite number of elements,
so it last cdr is nil, but one or more of whose elements
is itself a circular list in the above sense? Is it in
some sense "circular" because of its circular-list element?
IOW, a list can have finite length but still share list
stucture with itself. Well, no, not really, but an
element of it can be a list that shares list structure
with itself. And so the finite-length list represents
an infinite tree.
For example, here's a one-element list whose only
element is the circular list (a a a a a a ...):
(setq foo '((a)))
(setcdr (car foo) foo)
foo ; ((a #1))
(length foo) ; 1
(nth 0 foo) ; (a #0)
(nth 1 foo) ; nil
(nth 0 (nth 0 foo)) ; a
(nth 1 (nth 0 foo)) ; (a #0)
(nth 2 (nth 0 foo)) ; nil
(nth 0 (nth 0 (nth 0 foo)) ; a
(nth 0 (nth 1 (nth 0 foo)) ; (a #0)
(nth 0 (nth 2 (nth 0 foo)) ; nil
...
It should be enough to say that a "true", or "proper"
list is one that has nil as its last cdr, without
adding that this means non-"circular".
- Re: Predicate for true lists, (continued)
- Re: Predicate for true lists, Basil L. Contovounesios, 2018/07/10
- Re: Predicate for true lists, Paul Eggert, 2018/07/10
- Re: Predicate for true lists, Basil L. Contovounesios, 2018/07/11
- Re: Predicate for true lists, Wilfred Hughes, 2018/07/15
- Re: Predicate for true lists, Paul Eggert, 2018/07/15
- Re: [Emacs-diffs] master babe0d4: Rearrange definition of zerop in subr.el, Karl Fogel, 2018/07/11
- Re: [Emacs-diffs] master babe0d4: Rearrange definition of zerop in subr.el, Basil L. Contovounesios, 2018/07/11
- Re: [Emacs-diffs] master babe0d4: Rearrange definition of zerop in subr.el, Paul Eggert, 2018/07/11
- Re: [Emacs-diffs] master babe0d4: Rearrange definition of zerop in subr.el, Basil L. Contovounesios, 2018/07/12
- Re: [Emacs-diffs] master babe0d4: Rearrange definition of zerop in subr.el, Basil L. Contovounesios, 2018/07/12
RE: Predicate for true lists,
Drew Adams <=
Re: Predicate for true lists, Paul Eggert, 2018/07/06