I am trying to use logical operations on reduce, for example:
(reduce and '(#t #t #t) 0)
This gives me an error, I'm not sure why.
(reduce + '(1 2 3) 0)
This works perfectly fine, but when I try to use the built-in and operation, it fails.
Can someone explain me why wouldn't this work? I am forced to use reduce on logical operation
reduce requires a function as its first argument, while and is a special form. Since special forms are not first class objects, they can not be used as arguments to functions (or be stored in variables).
An alternative to reduce in this case is
(every identity list-of-booleans)
while
(any identity list-of-booleans)
is a working alternative to (reduce or ...)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With