Function: -prodfn

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

Signature

(-prodfn &rest FNS)

Documentation

Return a function that applies each of FNS to each of a list of arguments.

Takes a list of N functions and returns a function that takes a list of length N, applying Ith function to Ith element of the input list. Returns a list of length N.

In types (for N=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d)

This function satisfies the following laws:

    (-compose (-prodfn f g ...)
              (-prodfn f' g' ...))
  = (-prodfn (-compose f f')
             (-compose g g')
             ...)

    (-prodfn f g ...)
  = (-juxt (-compose f (-partial #'nth 0))
           (-compose g (-partial #'nth 1))
           ...)

    (-compose (-prodfn f g ...)
              (-juxt f' g' ...))
  = (-juxt (-compose f f')
           (-compose g g')
           ...)

    (-compose (-partial #'nth n)
              (-prod f1 f2 ...))
  = (-compose fn (-partial #'nth n))

View in manual

Source Code

;; Defined in ~/.emacs.d/elpa/dash-20260221.1346/dash.el
(defun -prodfn (&rest fns)
  "Return a function that applies each of FNS to each of a list of arguments.

Takes a list of N functions and returns a function that takes a
list of length N, applying Ith function to Ith element of the
input list.  Returns a list of length N.

In types (for N=2): ((a -> b), (c -> d)) -> (a, c) -> (b, d)

This function satisfies the following laws:

    (-compose (-prodfn f g ...)
              (-prodfn f\\=' g\\=' ...))
  = (-prodfn (-compose f f\\=')
             (-compose g g\\=')
             ...)

    (-prodfn f g ...)
  = (-juxt (-compose f (-partial #\\='nth 0))
           (-compose g (-partial #\\='nth 1))
           ...)

    (-compose (-prodfn f g ...)
              (-juxt f\\=' g\\=' ...))
  = (-juxt (-compose f f\\=')
           (-compose g g\\=')
           ...)

    (-compose (-partial #\\='nth n)
              (-prod f1 f2 ...))
  = (-compose fn (-partial #\\='nth n))"
  (declare (pure t) (side-effect-free t))
  (lambda (x) (--zip-with (funcall it other) fns x)))