[Top][All Lists]

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

Re: Why is booleanp defined this way?

From: Rusi
Subject: Re: Why is booleanp defined this way?
Date: Fri, 17 Apr 2015 19:01:11 -0700 (PDT)
User-agent: G2/1.0

On Saturday, April 18, 2015 at 2:05:11 AM UTC+5:30, Marcin Borkowski wrote:
> 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,

Elisp does not have a proper boolean type; unlike say symbols with
symbolp, strings with stringp, numberp -- some union of numeric types etc.
However programmers need boolean in their ontology even if (and even more if)
the language does not support it.

I'd say booleanp is a hesitant step towards supporting boolean in the ontology
without supporting it in the language.

reply via email to

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