The Composite
Compose logical structures into tree structures to represent part-whole hierarchies of enchantments.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Transmutation // Assemblage
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ISABELLE PATTERN //
theory Composite
imports Main
begin
datatype enchantment =
Leaf_Enchantment string
| Composite_Enchantment "enchantment list"
fun evaluate_enchantment :: "enchantment \<Rightarrow> nat" where
"evaluate_enchantment (Leaf_Enchantment _) = 1"
| "evaluate_enchantment (Composite_Enchantment es) = sum_list (map evaluate_enchantment es)"
end
Runic Tags:
#isabelle
#hol
#transmutation
#design-patterns