1 2 3 4 5 6 7 8 9 10 11 12 13 14
cache←{ Empty⇐{0=≠𝕩} Push⇐{(⍋⊑¨)⊸⊏𝕩∾𝕨} Pop⇐{(⊏⋈(1↓⊢))𝕩} } a←(⍋⊑¨)⊸⊏∘‿2⊸⥊⟨2,"a",1,"b",4,"c"⟩ 0=cache.Empty a 1=cache.Empty ∘‿2⊸⥊⟨⟩ 0‿"x" cache.Push a 1‿"x" cache.Push a 3‿"x" cache.Push a 5‿"x" cache.Push a 5‿"x" cache.Pop a