3 ms·
Huh. That's an interesting question. I looked up the original LISP paper (http://www-formal.stanford.edu/jmc/recursive.pdf http://www-formal.stanford.edu/jmc/re
by lambda 6y ago
Huh. That's an interesting question. I looked up the original LISP paper (http://www-formal.stanford.edu/jmc/recursive.pdf http://www-formal.stanford.edu/jmc/recursive.pdf), and it looks like the -p convention hadn't been established yet at that point, none of the predicates have that suffix in the paper. But it does say this:
(LABEL, SUBST, (LAMBDA, (X, Y, Z), (COND ((ATOM, Z),
(COND,(EQ, Y, Z), X), ((QUOTE, T), Z))), ((QUOTE, T), (CONS,
(SUBST, X, Y,(CAR Z)), (SUBST, X, Y, (CDR, Z)))))))
This notation is writable and somewhat readable. It can be
made easier to read and write at the cost of making its
structure less regular. If more characters were available
on the computer, it could be improved considerably.[4]
----
[4] 1995: More characters were made available on SAIL and
later on the Lisp machines.Alas, the world went back to
inferior character sets again—though not as far back as
when this paper was written in early 1959
So at the very least, some of the syntactic conventions of LISP were mostly due to limited character sets at the time.
Trying to binary search through history to figure out when the -p convention was introduced, I checked the original Scheme paper (https://web.archive.org/web/20171201033214/http://repository.readscheme.org/ftp/papers/ai-lab-pubs/AIM-349.pdf https://web.archive.org/web/20171201033214/http://repository...), which has some examples in Scheme as well as implementation code in MacLISP. It looks like the predicate convention wasn't really strongly established at that point; in a few places, they use variables with a trailing `?` in the Scheme code, but I don't see any use of a predicate convention in the MacLISP implementation code.
Going back a bit, I do see the predicate convention mentioned in an Interlisp manual from 1974, but without an explanation of its origin (http://bitsavers.trailing-edge.com/pdf/xerox/interlisp/Interlisp_Reference_Manual_1974.pdf http://bitsavers.trailing-edge.com/pdf/xerox/interlisp/Inter...).
A MacLISP manual from the same year also mentions the -p convention, but not its origins. So looks like it had been firmly established by 1974: http://www.softwarepreservation.org/projects/LISP/MIT/Moon-MACLISP_Reference_Manual-Apr_08_1974.pdf http://www.softwarepreservation.org/projects/LISP/MIT/Moon-M...
Going back further, the LISP 1.5 manual (second edition, 1965, though the printing was from 1979) has a number of numeric predicates with the -p suffix, but it does not make note of the suffix convention (https://archive.org/details/lisp15programmer00john/page/26/mode/2up?q=predicate https://archive.org/details/lisp15programmer00john/page/26/m... , free registration required). It does use a lot of language discussing "predicate" and use the term "p position of a conditional expression" (https://archive.org/details/lisp15programmer00john/page/22/mode/2up?q=predicate https://archive.org/details/lisp15programmer00john/page/22/m...), so the use of "p" for "predicate" rather than "?" seems to be somewhat well established. LISP 1.5 had a very restrictive syntax for identifiers, they were just alphanumeric.
So, I'm going to say that while it's possible that the usage of P for this purpose comes from substitutiong P for ?, all of the sources I've found seem to indicate that it stands for "predicate."
- hyperdimension 6y agoThank you so much for all that research on just an idle question of mine! I just noticed the similarity, but you really dug into it. It's interesting the creativity (like all art) that comes out when limitations and obstacles are met.