Function: -andfn

-andfn is a byte-compiled function defined in dash.el.

Signature

(-andfn &rest PREDS)

Documentation

Return a predicate that returns non-nil if all PREDS do so.

The returned predicate P takes a variable number of arguments and passes them to each predicate in PREDS in turn. If any one of PREDS returns nil, P also returns nil without calling the remaining PREDS. If all PREDS return non-nil, P returns the last such value. If no PREDS are given, P always returns non-nil.

See also: -orfn and -not.

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -andfn (&rest preds)
  "Return a predicate that returns non-nil if all PREDS do so.
The returned predicate P takes a variable number of arguments and
passes them to each predicate in PREDS in turn.  If any one of
PREDS returns nil, P also returns nil without calling the
remaining PREDS.  If all PREDS return non-nil, P returns the last
such value.  If no PREDS are given, P always returns non-nil.

See also: `-orfn' and `-not'."
  (declare (pure t) (side-effect-free error-free))
  ;; Open-code for speed.
  (cond ((cdr preds) (lambda (&rest args) (--every (apply it args) preds)))
        (preds (car preds))
        ((static-if (fboundp 'always)
             #'always
           (lambda (&rest _) t)))))