def pop.rot

bend-lawful-stdlib@0.1.0.0 · src/queue.bend:32

import bend-lawful-stdlib@0.1.0.0/src/queue.bend as Queue
import Base
import bend-lawful-stdlib@0.1.0.0/src/list.bend as List

32# front is empty; f is the reversed rear
33def pop.rot(-A: Data, f: List<&2, A>) -> List.Step<&1, A, Queue<A>>:
34  match f:
35    case Nil{}:
36      List.Stop{}
37    case h <> t:
38      List.Next{h, Queue{t, Nil{}}}

Uses (3)

Used by (2)