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

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

Re: canonical name ending "-p"


From: Pascal J. Bourguignon
Subject: Re: canonical name ending "-p"
Date: Fri, 18 Mar 2011 18:56:37 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

ken <gebser@mousecar.com> writes:

> Lots of things in elisp end in "-p"... is there some particular meaning
> in this?

They are predicates.  Predicates are functions that usually take a
single argument, and return a boolean attribute of this argument.

In some cases, it may be a generalized boolean, with an interesting
value for true.

For example, (digit-char-p ?9) --> 9 which is true, but more
interesting, since it's also the numeric value of the digit character.


Notice also, as this example shows, that some classical predicates don't
have the p or -p suffix.  For example: atom

   (atom x) == (not (consp x))



A single word predicate would end with p, a multiword one with -p:

   integerp
   upper-case-p 


-- 
__Pascal Bourguignon__                     http://www.informatimago.com/
A bad day in () is better than a good day in {}.


reply via email to

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