The Strategy
Swapping out different sorting algorithms for an array of captured souls.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Strategy
ARCANUM SCHOOL: Evocation // Tactical Weaving
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
NB. Strategies
strat_asc =: /:~
strat_desc =: \:~
NB. Context uses an adverb to apply strategy
sort_souls =: 1 : 0
u y
)
souls =: 5 2 8 1 9
NB. Usage:
NB. strat_asc sort_souls souls
NB. strat_desc sort_souls souls
Adverbs applying passed verbs act dynamically as interchangeable strategies.
Runic Tags:
#strategy
#adverbs
#sorting
#arrays