The Flyweight
Sharing common runic substructures in a massive array grid to save arcane essence.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Flyweight
ARCANUM SCHOOL: Transmutation // Essence Compression
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
NB. J's symbol type ('s') acts as a flyweight, interning strings
runes =: s: 'fire' ; 'ice' ; 'fire' ; 'lightning' ; 'ice'
NB. Memory used is minimal as 'fire' and 'ice' are stored once
NB. Operations like comparison are highly optimized
is_fire =: runes = s: <'fire'
The s: (symbol) datatype inherently implements the Flyweight pattern in J, interning boxed strings for fast comparison and low memory footprint.
Runic Tags:
#flyweight
#symbols
#interning
#memory