The Decorator
Enhancing spell effects via higher-order functions.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Decorator
ARCANUM SCHOOL: Transmutation // Aura Enhancement
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// GLEAM PATTERN //
pub type SpellFn = fn(Int) -> Int
pub fn base_fireball(mana: Int) -> Int {
mana * 2
}
pub fn empower(spell: SpellFn) -> SpellFn {
fn(mana) { spell(mana) + 10 }
}
pub fn maximize(spell: SpellFn) -> SpellFn {
fn(mana) { spell(mana) * 3 }
}
// Usage:
// let ultimate_fireball = base_fireball |> empower |> maximize
The Decorator
Higher-order functions wrap simple spells in layered auras of immense power.
Runic Tags:
#transmutation
#decorator
#gleam