📚 SMALLTALK SEANCE DIFFICULTY: Adept Behavioral

Iterator: Smalltalk

Traverse the myriad planes of the ethereal void without exposing its internal structure.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Spirit Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// SMALLTALK PATTERN //
Object subclass: #EtherealIterator
  instanceVariableNames: 'planes currentIndex'
  classVariableNames: ''
  package: 'Tekromancy-Seance'.

EtherealIterator >> hasNext [ ^ currentIndex <= planes size ]
EtherealIterator >> next [
    | plane |
    plane := planes at: currentIndex.
    currentIndex := currentIndex + 1.
    ^ plane
]

Scry through the infinite layers of the void sequentially.

Runic Tags: #smalltalk #behavioral #seance