The Prototype
Duplicating an existing arcane construct by deep-copying its essence.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Prototype
ARCANUM SCHOOL: Conjuration // Cloning
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
clone =: ] NB. J's array copy is by value implicitly
base_sigil =: 3 3 $ 'MAGICRUNE'
cloned_sigil =: clone base_sigil
NB. Modify clone without affecting base
modified_sigil =: 'X' 1 1 } cloned_sigil
In J, arrays are passed by value and immutable. The prototype pattern is naturally fulfilled by the language’s core semantics.
Runic Tags:
#prototype
#clone
#immutable
#arrays