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

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

Why is booleanp defined this way?


From: Marcin Borkowski
Subject: Why is booleanp defined this way?
Date: Fri, 17 Apr 2015 22:34:45 +0200

Hi all,

this is what I found in subr.el:

,----
| (defun booleanp (object)
|   "Return t if OBJECT is one of the two canonical boolean values: t or nil.
| Otherwise, return nil."
|   (and (memq object '(nil t)) t))
`----

Seemingly, it doesn't make much sense: what is the purpose of saying

(and (whatever) t)

instead of just

(whatever)

for a predicate?  Of course, this "normalizes" any "truthy" value to
"t", but is it really needed for anything (except perhaps being
elegant)?

Best,

-- 
Marcin Borkowski
http://octd.wmi.amu.edu.pl/en/Marcin_Borkowski
Faculty of Mathematics and Computer Science
Adam Mickiewicz University



reply via email to

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