⚙️ MIRANDA RUNE DIFFICULTY: Adept Behavioral

The Template Method of the Ancestral Monad

Defining the skeleton of a pure algorithm, deferring steps to injected functions.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Template Method
ARCANUM SCHOOL: Enchantment // Ancestral Monad
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// MIRANDA PATTERN //
|| Template Method supplies the structure, caller supplies the pieces.

template_algorithm :: (num -> num) -> (num -> num) -> num -> num
template_algorithm step1 step2 input = step2 (step1 input)

concrete_step1 :: num -> num
concrete_step1 x = x * 2

concrete_step2 :: num -> num
concrete_step2 x = x + 10

final_invocation :: num -> num
final_invocation = template_algorithm concrete_step1 concrete_step2
Runic Tags: #miranda #behavioral #template-method #ancestral-monad