The Iterator of Web Runes
Traverse the layers of an ancient tome without exposing its internal runes.
✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Chrono-Sequencing
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// PURESCRIPT PATTERN //
module Arcane.Iterator where
import Prelude
import Data.List (List(..))
-- Iterator pattern is naturally represented via pure functional lazy streams or lists
data SpellTome a = Chapter a (SpellTome a) | End
iterateTome :: forall a. SpellTome a -> List a
iterateTome End = Nil
iterateTome (Chapter a rest) = Cons a (iterateTome rest)
Runic Tags:
#behavioral
#iterator
#purescript
#runes