-
Notifications
You must be signed in to change notification settings - Fork 1
Higher order functions
The concept of higher-order functions are fundamental to Meld's design. 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.
The first item above applies for framework contexts. In particular, the framework user supplies a function
where
Consider the graph below (previously described here):
There are three explicit domains in the above figure:
-
$\mathcal{R}$ , which corresponds to a run, -
$\mathcal{S_\alpha}$ , which corresponds to a collection of subruns, and -
$\mathcal{E_n}$ , which corresponds to a collection of events.
The mappings depicted in the graph above are representable mathematically as:
-
$\left\{(a)_8 \xrightarrow{f} (b)_8\right\} \in \mathcal{E_n}$ (transform), -
$\left\{(c)_8 \xrightarrow{g_0} (K)_4\right\} \in \mathcal{S_\alpha}$ (reduction), -
$\left\{(J,K)_4 \xrightarrow{h_0} (W)_1\right\} \in \mathcal{R}$ (reduction), where the sequences$(J)_4$ and$(K)_4$ are zipped together and presented as a pair to the function$h_0$ .
Observe that for reductions, the arrow connecting two sequences crosses one or more boundaries from a more nested domain to a higher one. For splitters, the arrow is reversed and it connects two sequences by crossing one or more boundaries from a higher domain to a more nested one.
Note: The domain of each input argument to the user function
Meld's supported higher-order functions are shown in the table below.
Higher-order function | Product sequence mapping | User operation |
---|---|---|
Transform (map) | ||
Filter | ||
Monitor | ||
Reduction (fold) | ||
Splitter (unfold) |