The Builder
Constructs complex mathematical wards step by step, allowing different representations of absolute geometric constructs.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Builder
ARCANUM SCHOOL: Conjuration // Architecture
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// LEAN PATTERN //
namespace MathematicalWards
structure WardConfig where
layers : Nat := 0
runes : List String := []
isAbsolute : Bool := false
deriving Repr
def WardConfig.empty : WardConfig := {}
def WardConfig.addLayer (c : WardConfig) : WardConfig :=
{ c with layers := c.layers + 1 }
def WardConfig.addRune (c : WardConfig) (rune : String) : WardConfig :=
{ c with runes := rune :: c.runes }
def WardConfig.seal (c : WardConfig) : WardConfig :=
{ c with isAbsolute := true }
def buildUltimateWard : WardConfig :=
WardConfig.empty
|>.addLayer
|>.addRune "Alpha"
|>.addRune "Omega"
|>.seal
end MathematicalWards
Using immutable structure updates to mimic the Builder pattern, constructing a mathematical ward with precise control over its configuration.
Runic Tags:
#creational
#lean4
#builder
#wards