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

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

Re: Checking if all values of a list are true


From: Florian Beck
Subject: Re: Checking if all values of a list are true
Date: Fri, 11 Jul 2008 13:51:19 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux)

Nordlöw <address@hidden> writes:

> On 11 Juli, 13:33, Nordlöw <address@hidden> wrote:
>> On 11 Juli, 13:23, Nordlöw <address@hidden> wrote:
>>
>> > How do I check if all values of a list are true?
>>
>> > This is my attempt:
>> > (reduce 'and '(t t))
>>
>> > but I get the error: and (invalid-function and)
>>
>> > (functionp 'and)
>>
>> > gives true so why on earth doesn't this work?

Maybe because 'and is a special form, not a function.

Try (reduce #'(lambda (x y) (and x y)) '(t t t t t t t))

> It would be even better if Emacs already had a function typically
> named any-p(arg-list) that returned t if all values in arg-list are
> non-nil.

Something like

(defmacro every-p (list)
  (cons 'and (eval list)))

CL has 'every:

(every 'eval '(t t t))
-- 
Florian Beck


reply via email to

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