Result is f .
Given two arguments, results in an application of b to a. Like UN*X pipe.
Example:
sort | uniq
Given two functions f and g, results in a function that, when given an argument x, calculates f (g x) .
Example:
compose uniq sort
Given a function of two arguments, results in a function with the arguments flipped.
Example:
define (>) flip (<)
Given a function f, results in a recursable function, i.e. rec f => f f.
Example:
define factorial rec \factorial \n if (n=0) 1 else n*(factorial (n - 1)) factorial 3 => 6 factorial 20 => 2432902008176640000
Gives b to a.
Given key, fails.
Given a table of (name, value) Pairs and a fallbackAction, returns a dispatcher for these.
Example:
dispatch [ ('bla, a) ('bli, b) ] raiseMissingSymbolError
is the same as
\key if (symbolsEqual? key 'bla) a elif (symbolsEqual? key 'bli) b else raiseMissingSymbolError key
But it is more commonly written using the #exports macro, if the names are the same:
dispatch [ ('bla, bla) ('bli, bli) ] raiseMissingSymbolError
is the same as
\key if (symbolsEqual? key 'bla) bla elif (symbolsEqual? key 'bli) bli else raiseMissingSymbolError key
is the same as
dispatch (#exports[bla bli]) raiseMissingSymbolError
Convenience for \table dispatch table raiseMissingSymbolError. Normally used only by Module dispatchers.
Example:
let Composition := requireModule "Composition" in let Arithmetic := requireModule "Arithmetic" in let (*) := Arithmetic.(*) in let square := \x x*x in Composition.dispatch1 (#exports[square])