def Deque.pop_front

bend-kit-collections@0.1.4.1 · deque.bend:100

import bend-kit-collections@0.1.4.1/deque.bend as Deque
import Base

100def Deque.pop_front(
101  a, -A: Kind(a), d: Deque<a, A>
102) -> Maybe<&1, A & Deque<a, A>>:
103  match d:
104    case Deq{f, b}:
105      match f:
106        case h <> t:
107          Some{(h, Deq{t, b})}
108        case Nil{}:
109          Deque.pop_front.refill(a, A, Deque.count(a, A, b))

Uses (7)

Used by (1)