I'm trying to apply a logic function over a list, but:

e.g.(apply 'and some_list) give me Invalid function: and.

There is a way to apply a logical function to a list?

  • C-h f apply.....
    – Drew
    Oct 15, 2018 at 22:48

1 Answer 1


This is because and is not a function (it is a special form).

Note that C-h f and tells you "and is a special form in `C source code'."

apply must be used with a function.

The manual says:

‘apply’ returns the result of calling FUNCTION.  As with ‘funcall’,
 FUNCTION must either be a Lisp function or a primitive function;
 special forms and macros do not make sense in ‘apply’.
  • there is any and function in elisp? Oct 15, 2018 at 21:47
  • 1
    It's not possible to write and as a function -- functions evaluate all of their arguments, whereas macros and special forms receive their arguments un-evaluated (which is necessary for and, which must not evaluate the remaining arguments if it has already failed).
    – phils
    Oct 15, 2018 at 21:52
  • there is a non lazy set of logic functions? or, what is the best way to do this? Oct 15, 2018 at 21:55
  • 4
    @FrancescoCadei For and you have (cl-every #'identity some_list) and for or you have (cl-some #'identity some_list).
    – Tobias
    Oct 15, 2018 at 21:59
  • 4
    If all you want is a nil or non-nil result, then (memq nil LIST) will tell you if any of the list elements is nil.
    – phils
    Oct 15, 2018 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.