The Iterator
Traverse hyper-dimensional organic arrays safely.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Array-Traversal
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// APL PATTERN //
:Class BiomassIterator
:Field Private Collection
:Field Private Index ← 1
∇ Make Coll
:Access Public
:Implements Constructor
Collection ← Coll
∇
∇ R←HasNext
:Access Public
R ← Index ≤ ≢Collection
∇
∇ R←Next
:Access Public
R ← Collection[Index]
Index ← Index + 1
∇
:EndClass
:Class AlienBiomass
:Field Private Cells ← '⍋' '⍒' '⍟' '⌾'
∇ R←GetIterator
:Access Public
R ← ⎕NEW BiomassIterator (Cells)
∇
:EndClass
Though APL natively excels at acting on arrays holistically, there are moments when alien biomatter must be dissected and traversed sequentially to avoid awakening a defense matrix. The Iterator abstracts the traversal mechanism away from the underlying collection (Cells), allowing an external entity to sequentially read the organic arrays (⍋ ⍒ ⍟ ⌾) while maintaining the aggregate structure’s integrity.
Runic Tags:
#apl
#behavioral
#alien
#iterator
#array-traversal