|
Dedekind 0.0.0
A structuralist C++23 Module Library
|
A term built at run time, the grammar with its shape a value; defined after the binding below. More...

Classes | |
| struct | SubstOne |
| The one-slot substitution as a slot map. More... | |
Public Types | |
| enum class | Kind { Proj , Const , Bin , Cond } |
Public Member Functions | |
| constexpr Term | subst (unsigned variable, const Term &with) const |
The term with the variable variable replaced by with: the substitution a structural arrow's image is (π ↦ π - 1 for the successor's). | |
| template<typename F> | |
| constexpr Term | map_slots (const F &f) const |
Every slot replaced at once by the term f gives it: a simultaneous substitution, so a renaming (a product's shift, a permutation) never captures. | |
Static Public Member Functions | |
| static constexpr Term | proj (unsigned slot) |
π (slot 0), π_1, π_2. | |
| static constexpr Term | constant (K k) |
| A constant. | |
| static constexpr Term | cond (Pred< K > q, Term a, Term b) |
McCarthy's conditional: a where q holds, else b; its body is instantiated where it is used, after Pred is complete. | |
| static constexpr Term | bin (Arith op, Term x, Term y) |
x op y. | |
Public Attributes | |
| Kind | kind {Kind::Const} |
| unsigned | slot {} |
| K | value {} |
| Arith | op {} |
| std::shared_ptr< const Term > | a |
| std::shared_ptr< const Term > | b |
| std::shared_ptr< const Pred< K > > | p |
A term built at run time, the grammar with its shape a value; defined after the binding below.
A term built at run time: the grammar of IsTerm with its shape a value and its constants of type K, which meets the carrier through carrier_cast when the term is bound; McCarthy's conditional cond(p, a, b) chooses a branch by a predicate. Its legs are shared, so a term is cheap to copy and to combine. A division by the constant 0 is refused when the term is built, as for the typed grammar.
| K | the constants' type. |
|
inlinestaticconstexpr |
x op y.
| std::domain_error | on a division by the constant 0. |
|
inlinestaticconstexpr |
McCarthy's conditional: a where q holds, else b; its body is instantiated where it is used, after Pred is complete.
| q | the predicate. |
| a,b | the branches. |
|
inlineconstexpr |
Every slot replaced at once by the term f gives it: a simultaneous substitution, so a renaming (a product's shift, a permutation) never captures.
| f | a slot to its replacement. |
|
inlineconstexpr |
The term with the variable variable replaced by with: the substitution a structural arrow's image is (π ↦ π - 1 for the successor's).
| variable | the slot. |
| with | its replacement. |