New answers tagged iteration
2
How about this?
(defun or-list (list)
(cl-some #'identity list))
Here cl-some takes two arguments: a predicate and a list and returns non-nil if the predicate applied to some member of the list is non-nil. In our case, the identity function is a good predicate since we only want to test whether our list members are themselves non-nil.
3
If you wanted this for a function you would use apply, but as or is a special form you can't do that. In particular, or only evaluates as many arguments as it needs to.
You could write a macro:
(defmacro or-list (list)
`(or ,@(eval list)))
(setq mylist '(a b c))
(or-list mylist) then expands to (or a b c)
Top 50 recent answers are included
Related Tags
iteration × 17mapping × 3
list × 2
conditionals × 2
org-mode × 1
org-agenda × 1
lexical-scoping × 1
common-lisp × 1
occur × 1
cl-lib × 1
filenames × 1
filtering × 1
boolean × 1