Note that I used SELECT here code, to step through items in order:
let suit-order: [♣ ♦ ♥ ♠]
; ...
suit: select suit-order suit
This advanced through the suits until the end was reached.
I also used it for dealing cards in directions. This case could start at any direction, and needed to cycle:
let direction-order: [N E S W]
;
direction: (select direction-order direction) else [first direction-order]
I was a bit torn on how to do this. I could have gone more like:
suit-state: head [♣ ♦ ♥ ♠]
suit: does [suit-state.1]
;
suit-state: next suit-state
This idea felt obfuscating; hiding the current suit in a series position just seemed wrong.
I even toyed with the idea of doing it as state transitions, if we are to think in terms of SELECT/SKIP 2 or SELECT seeking out SET-WORD! :
next-suit: [
♣: ♦
♦: ♥
♥: ♠
♠: _
]
; ...
suit: select next-suit suit
But that's just not what I was looking for. I felt in the end the suit order had to be just what it was, as suit-order: [♣ ♦ ♥ ♠]
...I don't know what it gets at, other than that what I was ultimately looking for here didn't fit either of our ideas. I really wanted to advance through things in a series in a context where FOR-EACH wasn't what I was using at that moment (because I was inside a PARSE rule that I didn't want to exit).
Food for thought.