Quark v1.0.1 Quark.SKI
The classic SKI system
combinators. s and k alone can be used to express any algorithm,
though generally not efficiently.
Summary
Functions
The identity combinator
The constant (“Konstant”) combinator. Returns the first argument, unchanged, and discards the second argument. Can be used to repeatedly apply the same value in functions such as folds
The “substitution” combinator. Applies the last argument to the first two, and then the first two to each other
Functions
The constant (“Konstant”) combinator. Returns the first argument, unchanged, and discards the second argument. Can be used to repeatedly apply the same value in functions such as folds.
iex> k(1, 2)
1
iex> k("happy", "sad")
"happy"
iex> Enum.reduce([1,2,3], [42], &k/2)
3
The “substitution” combinator. Applies the last argument to the first two, and then the first two to each other.
iex> add = &(&1 + &2)
iex> double = &(&1 * 2)
iex> s(add, double, 8)
24