Skip to content

7) Predicate composition

Julien Cumin edited this page Jan 8, 2019 · 5 revisions

Predicates can be composed with each other in more elaborate ways using the angled brackets ⟨…⟩.

Predicate compositions are considered to be user defined predicates (like {…}) and are numeroted as such.

Compositions can contain other compositions.

⟨ab⟩ - Sandwiches

Sandwiches are a composition of 2 predicates a and b. It gets translated as such:

⟨ab⟩    ->   {[I,J]∧Ia.bJ∧}

Example usage: find a permutation of a string that begins with a certain letter: ⟨ph⟩

⟨abc⟩ - Forks

Forks are compositions of 3 predicates a, b and c. It gets translated as such:

⟨abc⟩   ->   {aI&cJ∧I;Jb}

Example usage: average of a list of integers: ⟨+/l⟩