### Functions
[
Datatype functions
Funcon function
Funcon apply
Funcon supply
Funcon compose
Funcon uncurry
Funcon curry
Funcon partial-apply
]
Meta-variables
T, T′, T1, T2 <: values
Datatype
functions(T,T′) ::= function(A:abstractions(T=>T′))
*/
Funcon
apply(_:functions(T, T′), _:T) : =>T′
*/
Rule
apply(function(abstraction(X)), V:T) ~> give(V, X)
Funcon
supply(_:functions(T, T′), _:T) : =>thunks(T′)
*/
Rule
supply(function(abstraction(X)), V:T) ~> thunk(abstraction(give(V, X)))
Funcon
compose(_:functions(T2, T′), _:functions(T1, T2)) : =>functions(T1, T′)
*/
Rule
compose(function(abstraction(Y)), function(abstraction(X)))
~> function(abstraction(give(X, Y)))
Funcon uncurry(F:functions(T1, functions(T2, T′))) :
=>functions(tuples(T1, T2), T′)
~> function(abstraction(
apply(
apply(F, checked index(1, tuple-elements given)),
checked index(2, tuple-elements given))))
*/
Funcon curry(F:functions(tuples(T1, T2), T′)) : =>functions(T1, functions(T2, T′))
~> function(abstraction(partial-apply(F, given)))
*/
Funcon partial-apply(F:functions(tuples(T1, T2), T′), V:T1) : =>functions(T2, T′)
~> function(abstraction(apply(F,tuple(V,given))))
*/
/*
`functions(T, T′)` consists of abstractions whose bodies may depend on a given value of type `T`, and whose executions normally compute values of type `T′`. `function(abstraction(X))` evaluates to a function with dynamic bindings, `function(closure(X))` computes a function with static bindings.