Hi, I have the following problem with REDUCE and AND:
> (reduce #'and '(T T nil T))
=> Error in function "DEFUN (SETF MACRO-FUNCTION)":
Cannot funcall macro functions
Any suggestions?
Tunc
"Jeff Greif" <···@spam-me-not.trivida.com> writes:
> Try
> (reduce #'(lambda (x y) (and x y)) '(t t nil t))
>
Assuming the original poster intended to use the construct to test if
a list contains all true (non nil) values it is better to use EVERY.
(every #'identity '(t t nil t))
EVERY returns false when the predicate (in this case, IDENTITY)
returns false. REDUCE always processes the entire sequence.
--
Samir Barjoud
·····@mindspring.com
In article <··············@mindspring.com>,
Samir Barjoud <·····@mindspring.com> wrote:
>"Jeff Greif" <···@spam-me-not.trivida.com> writes:
>
>> Try
>> (reduce #'(lambda (x y) (and x y)) '(t t nil t))
>>
>
>Assuming the original poster intended to use the construct to test if
>a list contains all true (non nil) values it is better to use EVERY.
>
>(every #'identity '(t t nil t))
For LOOP fans:
(loop for x in '(t t nil t) always x)
ACL, at least, compiles the first into a call to EVERY
and the second into an open loop.
Paul
>>>>> "Jeff" == Jeff Greif <···@spam-me-not.trivida.com> writes:
Jeff> Try (reduce #'(lambda (x y) (and x y)) '(t t nil t))
or:
(every #'identity '(t t nil t))
Sent via Deja.com http://www.deja.com/
Before you buy.
>Try
>(reduce #'(lambda (x y) (and x y)) '(t t nil t))
Excuse me, what this "function" stands for ?
It's work without that, in form
(reduce (lambda (x y) (and x y)) '(t t nil t))
Arseny Slobodjuck:
> >(reduce #'(lambda (x y) (and x y)) '(t t nil t))
> Excuse me, what this "function" stands for ?
"The function described by the lambda list."
> It's work without that, in form
> (reduce (lambda (x y) (and x y)) '(t t nil t))
The LAMBDA _macro_ let's you get away without the #' or FUNCTION.
rthappe