[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why is booleanp defined this way?
From: |
Pascal J. Bourguignon |
Subject: |
Re: Why is booleanp defined this way? |
Date: |
Sat, 18 Apr 2015 02:41:51 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) |
Emanuel Berg <embe8573@student.uu.se> writes:
> 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
You may want to compare:
(defun normalize-boolean (obj)
(if obj t))
(disassemble (byte-compile 'normalize-boolean))
byte code:
args: (obj)
0 varref obj
1 goto-if-nil-else-pop 1
4 constant t
5:1 return
with:
(defun g (x) (not (not x)))
byte code:
args: (x)
0 varref x
1 not
2 not
3 return
(disassemble (byte-compile 'f))
> 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.
Of course. That's what the "p" in "booleanp" means!
--
__Pascal Bourguignon__ http://www.informatimago.com/
“The factory of the future will have only two employees, a man and a
dog. The man will be there to feed the dog. The dog will be there to
keep the man from touching the equipment.” -- Carl Bass CEO Autodesk
- 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, 2015/04/17
- Re: Why is booleanp defined this way?,
Pascal J. Bourguignon <=
- 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