The Composite of the Esoteric Order
Treating single initiates and entire cult cabals uniformly.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Composite
ARCANUM SCHOOL: Enchantment // Mind Control
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// ANCIENT LISP METAMAGIC //
(defpackage :esoteric-composite
(:use :cl))
(in-package :esoteric-composite)
(defgeneric perform-task (node task))
;; The Component
(defclass cult-component ()
((name :initarg :name :reader component-name)))
;; The Leaf
(defclass initiate (cult-component) ())
(defmethod perform-task ((node initiate) task)
(format t "Initiate ~a mindlessly executes: ~a~%" (component-name node) task))
;; The Composite
(defclass cabal (cult-component)
((members :initform nil :accessor cabal-members)))
(defmethod add-member ((c cabal) (m cult-component))
(push m (cabal-members c)))
(defmethod perform-task ((node cabal) task)
(format t "Cabal ~a receives task: ~a. Delegating...~%" (component-name node) task)
(dolist (m (cabal-members node))
(perform-task m task)))
;; Macro to assemble cabals rapidly
(defmacro defcabal (name &rest members)
`(let ((c (make-instance 'cabal :name ,name)))
,@(loop for m in members
collect `(add-member c ,m))
c))
The Composite of the Esoteric Order
When the high priest of Dagon issues a command, they do not care if it is executed by a single mutated initiate or an entire nested hierarchy of cabals. The intent of the hive mind must propagate downwards uniformly.
The Composite pattern models this eldritch tree structure perfectly. Both initiate and cabal share the same perform-task interface. The cabal iterates through its collected sub-nodes, passing the dark instructions deeper into the network. Through a simple defcabal macro, we can sculpt massive architectures of devotion that obey a single, recursive command structure.
Runic Tags:
#lisp
#structural
#composite
#cults
#macros