Strategy in Dhall
Inject algorithmic logic dynamically into higher-order evaluation spells.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Enchantment // Tactics
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// DHALL PATTERN //
let Strategy = Natural -> Natural -> Natural
let addStrategy : Strategy = \(a : Natural) -> \(b : Natural) -> a + b
let multStrategy : Strategy = \(a : Natural) -> \(b : Natural) -> a * b
let executeRune = \(strat : Strategy) -> \(a : Natural) -> \(b : Natural) ->
strat a b
in executeRune multStrategy 5 10
Due to its nature as a functional language, Dhall treats functions as first-class citizens. The Strategy pattern requires no complex object instantiation; an archmage simply passes the desired mathematical or configuration transformation as a function argument, swapping execution tactics with total halting confidence.
Runic Tags:
#dhall
#halting
#runes
#configuration
#behavioral