I’m trying to write something like this:
(setq l '(nil t nil nil))
(seq-reduce 'and l t)
I get this error:
Invalid function: and
My understanding, after a bit of googling, is that this is due to and being a special form.
What would be a good way to make this work? Is there a function equivalent to and? Is there some way to make a function out of a special form? I couldn’t find any documentation about this. I tried to write a function that does what and does, but that seems overkill.
The
seq-reducefunction usesfuncallto invoke its function argument, and as shown in thefuncalldocumentation, a special form likeandcan't be passed to it; calling(funcall 'and t nil)results in anInvalid function: #<subr and>error.You can make the call to
andin alambdainstead: