Skip to content

Higher order functions

Kyle Knoepfel edited this page May 9, 2023 · 8 revisions

The Wikipedia definition of a higher-order function is:

A function that does at least one of the following:

  • takes one or more functions as arguments, which is a parameter of a procedure that is itself a procedure,
  • returns a function as its result.

Meld's supported higher-order functions are shown in the table below.

Higher-order function Product sequence mapping User operation
Transform (map) $(\boldsymbol{a})_n \xrightarrow{f} (\boldsymbol{b})_n$ $f(\boldsymbol{a}) \rightarrow \boldsymbol{b}$
Filter $(\boldsymbol{a})_n \xrightarrow{f} (\boldsymbol{a})_m$ $f(\boldsymbol{a}) \rightarrow \text{Bool}$
Monitor $(\boldsymbol{a})_n \xrightarrow{f} (\ \ )_0$ $f(\boldsymbol{a}) \rightarrow \text{Void}$
Reduction (fold) $(\boldsymbol{a})_n \xrightarrow{f} (\boldsymbol{b})_1$ $f(\boldsymbol{a}, \boldsymbol{b}) \rightarrow \boldsymbol{b}$
Splitter (unfold) $(\boldsymbol{a})_1 \xrightarrow{f} (\boldsymbol{b})_n$ $f(\boldsymbol{a}) \rightarrow (\boldsymbol{b})_p$
Clone this wiki locally