GNU bug report logs -
#7086
`booleanp' return value is multi-valued list
Previous Next
Reported by: MON KEY <monkey <at> sandpframing.com>
Date: Wed, 22 Sep 2010 21:56:01 UTC
Severity: minor
Tags: notabug
Done: Chong Yidong <cyd <at> stupidchicken.com>
Bug is archived. No further changes may be made.
Full log
Message #32 received at submit <at> debbugs.gnu.org (full text, mbox):
MON KEY wrote:
> This one matters. It is the penultimate Emacs lisp predicate.
> It tests for a boolean value yet it returns a list.
Which you can happily dispatch on:
(if (booleanp foo)
(if (null foo)
(do-something-if-foo-is-nil)
(do-something-if-foo-is-t))
(do-something-if-foo-is-neither-nil-nor-t))
It's hard to see what else is required
[...]
> On Thu, Sep 23, 2010 at 4:12 AM, Eli Zaretskii <eliz <at> gnu.org> wrote:
[...] MON KEY claims that (funcall (lambda (x) (booleanp x)))
giving an error is somehow problematic.
>> Exactly! See the above node in the manual.
>> But this has nothing to do with booleanp.
> It has everything to do with it. These are just the types of
> situations where interrogating a boolean is what is wanted.
What?
(funcall (lambda (x) (1+ x)))
=> (wrong-number-of-arguments (lambda (x) (1+ x)) 0)
(funcall (lambda (x) (booleanp x)))
=> (wrong-number-of-arguments (lambda (x) (booleanp x)) 0)
Calling a function expecting an argument without one is an error,
irrespective of the function involved.
Do you in fact want:
(require 'cl)
(defun* foo (&optional (x nil got-x-p))
(if got-x-p
(do-something-if-x-was-an-argument x)
(do-something-different)))
[...]
--
Lawrence Mitchell <wence <at> gmx.li>
This bug report was last modified 14 years and 292 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.