Queue.pop: def of bend-lawful-stdlib@0.1.0.0
Import: import bend-lawful-stdlib@0.1.0.0/src/queue.bend as Queue
Lines 40-45 of bend-lawful-stdlib@0.1.0.0/src/queue.bend: https://jend.leeeet.dev/read.txt?path=bend-lawful-stdlib@0.1.0.0/src/queue.bend&start_line=40&end_line=45
import Base
import bend-lawful-stdlib@0.1.0.0/src/list.bend as List
def pop(-A: Data, q: Queue) -> List.Step<&1, A, Queue>:
match q:
case Queue{Nil{}, r}:
pop.rot(A, List.reverse(&2, A, r))
case Queue{h <> t, r}:
List.Next{h, Queue{t, r}}
Uses (5):
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List
https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.reverse
https://jend.leeeet.dev/definition.txt?path=bend-lawful-stdlib@0.1.0.0/src/list.bend&name=Step
https://jend.leeeet.dev/definition.txt?path=bend-lawful-stdlib@0.1.0.0/src/queue.bend&name=Queue
https://jend.leeeet.dev/definition.txt?path=bend-lawful-stdlib@0.1.0.0/src/queue.bend&name=pop.rot