The Composite Incantation
Treating individual sigils and sprawling rune clusters uniformly.
β§ GANG OF FOUR LINEAGE & ARCANUM β§
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Illusion // Fractal
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CLOJURE PATTERN //
(ns tekromancy.composite)
;; Clojure's tree data structures are composites by nature.
(defprotocol EvalRune
(evaluate [_]))
(defrecord LeafRune [power]
EvalRune
(evaluate [_] power))
(defrecord ClusterRune [runes]
EvalRune
(evaluate [_]
(reduce + (map evaluate runes))))
;; Usage:
;; (evaluate (->ClusterRune [(->LeafRune 10)
;; (->ClusterRune [(->LeafRune 20) (->LeafRune 5)])]))
In the arcane fractal geometry of the JVM, a single rune and a cluster of runes must react symmetrically to the casterβs will. By defining a protocol and recursively applying it across both leaves and branches, the Composite pattern unfolds naturally, harnessing map-reduce pipelines.
Runic Tags:
#structural
#composite
#clojure
#trees