Module tql_fun

Function Index

all/1Compose a bunch of predicates using logical conjunction.
any/1Compose a bunch of predicates using logical disjunction.
compose/1Compose many functions.
compose/2Compose 2 functions.
negate/1Logical negation for a predicate.
sequence/2Given a list of functions and an input, return a list where each element represents the output of running the matching function on the input.

Function Details

all/1

all(Fs::[fun((A) -> boolean())]) -> fun((A) -> boolean())

Compose a bunch of predicates using logical conjunction.

For any given X, the resulting function will return true if and only if all of the specified functions would return true for that same input. Beware vacuous truths: if the list of predicates is empty, "all" predicates return true.

any/1

any(Fs::[fun((A) -> boolean())]) -> fun((A) -> boolean())

Compose a bunch of predicates using logical disjunction.

For any given X, the resulting function will return true if at least one of the specified predicates would return true.

compose/1

compose(Fs::[Fun]) -> Fun

Compose many functions.

Given inputs [F1, F2, ..., Fn], returns F1 ∘ F2 ∘ ... ∘ Fn. Note that function composition is associative, but not commutative. As such, keep in mind that functions are executed last to first.

compose/2

compose(F::fun((A) -> B), G::fun((B) -> C)) -> fun((A) -> C)

Compose 2 functions.

Given functions F and G, returns a F ∘ G.

     F = fun (X) -> X * 2 end,
     G = fun (X) -> X + 1 end,
     H1 = compose(F, G),
     H2 = compose(G, F),
     10 = H1(4),
     9 = H2(4).

negate/1

negate(F::fun((A) -> boolean())) -> fun((A) -> boolean())

Logical negation for a predicate.

sequence/2

sequence(Fs::[Fun], A) -> [B]

Given a list of functions and an input, return a list where each element represents the output of running the matching function on the input.


Generated by EDoc