def Deque.count

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

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

36# a list and its length, in one pass that hands the list back
37def Deque.count(a, -A: Kind(a), xs: List<a, A>) -> List<a, A> & Nat:
38  match xs:
39    case Nil{}:
40      (Nil{}, 0n)
41    case h <> t:
42      Deque.count.put(a, A, h, Deque.count(a, A, t))

Uses (5)

Used by (2)