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

[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 03:06:02 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux)

"Pascal J. Bourguignon" <pjb@informatimago.com>
writes:

> 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))

... you mean 'g?

Are you saying (not (not x)) generates more efficient
byte-code? I hate to break it to you, but the
Commodore 64 demo era is long gone :)

>> 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!

If that is "of course" then what are we talking about?

-- 
underground experts united
http://user.it.uu.se/~embe8573


reply via email to

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