✨ ARCANUM RUNE DIFFICULTY: Apprentice Behavioral

The Iterator (jq)

Unfurl collections into streams, transcending structural boundaries.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Iterator
ARCANUM SCHOOL: Divination // Scrying
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// CODEX INCANTATION //
# Extracting elements from a nested labyrinth
def walk_and_yield:
  .. | objects | select(has("target")) | .target;

# Iterating over the stream
[ walk_and_yield ] | map(. * 2)

jq is natively built upon the concept of generators and streams. The Iterator pattern here is manifested by the recursive descent operator (..) and stream extraction ([]). Rather than maintaining complex pointer states, we shatter the JSON structure, yielding a continuous, flat stream of targets ripe for transmutation.

Runic Tags: #jq #json #transmutation #gof