The Prototype Incantation
Cloning immutable essences to spawn new manifestations.
β§ GANG OF FOUR LINEAGE & ARCANUM β§
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Illusion // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CLOJURE PATTERN //
(ns tekromancy.prototype)
;; In Clojure, prototypes are just immutable maps.
;; Cloning is merely merging or associating new values into an existing map.
(def base-phantom
{:health 100 :mana 50 :type :phantom})
(defn spawn-mutated-phantom [prototype mutation]
(merge prototype mutation))
;; Usage:
;; (def fire-phantom (spawn-mutated-phantom base-phantom {:type :fire-phantom :mana 100}))
Why cast a complex summoning spell when you can clone an existing essence? In the Lisp-like matrix, data is immutable, so βcloningβ is practically instantaneous and memory-efficient via structural sharing. The Prototype pattern is effortlessly realized through map manipulations.
Runic Tags:
#creational
#prototype
#clojure
#immutable-data