[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is booleanp defined this way?
From: |
Emanuel Berg |
Subject: |
Re: Why is booleanp defined this way? |
Date: |
Sat, 18 Apr 2015 01:06:32 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) |
jorge.alfaro-murillo@yale.edu (Jorge A.
Alfaro-Murillo) writes:
>> Of course, this "normalizes" any "truthy" value to
>> "t", but is it really needed for anything (except
>> perhaps being elegant)?
>
> Perhaps so that it returns t instead of whatever, if
> whatever is not nil.
Yes, I think this is what the OP means by
"normalizes". Normalization is a university buzzword
for example in linear algebra where two vectors are
normalized to a common coordination system so they can
be compared.
But...
(booleanp t) ; t
(booleanp nil) ; t
(booleanp 1) ; nil!
To me it looks like t and nil as arguments evaluate to
t, and everything else nil - everything else that
isn't evaluated first to either of t or nil,
of course.
The "normalization" of which you speak should rather
look something like this:
(defun normalize-boolean (obj)
(if obj t) ) ; implicit (if obj t nil)
(normalize-boolean 1) ; t
(normalize-boolean nil) ; nil
Or do you mean that `and' normalizes? It can, but that
would depend on the order:
(and 1 t) ; t
(and t 1) ; 1
So I think `booleanp' shouldn't be thought of as
a normalizer but rather as a type predicate, much like
them `stringp', `integerp', and so on.
--
underground experts united
http://user.it.uu.se/~embe8573
- Why is booleanp defined this way?, Marcin Borkowski, 2015/04/17
- Re: Why is booleanp defined this way?, Jorge A. Alfaro-Murillo, 2015/04/17
- Message not available
- Re: Why is booleanp defined this way?,
Emanuel Berg <=
- Re: Why is booleanp defined this way?, Pascal J. Bourguignon, 2015/04/17
- Re: Why is booleanp defined this way?, Emanuel Berg, 2015/04/17
- Re: Why is booleanp defined this way?, Pascal J. Bourguignon, 2015/04/17
- Re: Why is booleanp defined this way?, Marcin Borkowski, 2015/04/18
- Re: Why is booleanp defined this way?, Stefan Nobis, 2015/04/18
- Re: Why is booleanp defined this way?, Emanuel Berg, 2015/04/19
RE: Why is booleanp defined this way?, Drew Adams, 2015/04/17
Re: Why is booleanp defined this way?, Tassilo Horn, 2015/04/18