[Top][All Lists]

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

bug#7086: `booleanp' return value is multi-valued list

From: Lawrence Mitchell
Subject: bug#7086: `booleanp' return value is multi-valued list
Date: Fri, 24 Sep 2010 10:28:41 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (usg-unix-v)

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)

It's hard to see what else is required


> On Thu, Sep 23, 2010 at 4:12 AM, Eli Zaretskii <address@hidden> 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.


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


Lawrence Mitchell <address@hidden>

reply via email to

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