Quark v1.0.1 Quark

For convenience, many of the most common combinators are available here and given firendlier names.

Due to performance reasons, many of the combinators are given non-combinatory implementations (ie: not everything is expressed in terms s and k)

Summary

Functions

compose(a, b)

See Quark.Compose.compose/2.

constant(a, b)

See Quark.SKI.k/2.

first(a, b)

See Quark.SKI.k/2.

flip(fun)

See Quark.BCKW.c/1.

id(x)

See Quark.SKI.i/1.

m()

Apply a function to itself


iex> import Quark, only: [m: 1]
iex> add_one = fn x -> x + 1 end
iex> add_two = m(add_one)
iex> add_two.(8)
10
m(fun)

Specs

m((... -> any)) :: (... -> any)
second()

Opposite of first (the k combinator).

Returns the second of two arguments. Can be used to repeatedly apply the same value in functions such as folds.


iex> Quark.second(43, 42)
42

iex> Enum.reduce([1,2,3], [], &Quark.second/2)
[]
second(a)
second(a, b)

Specs

second(any, any) :: any
self_apply()

See Quark.m/0.

self_apply(fun)

See Quark.m/1.