def count

bend-lawful-stdlib@0.1.0.0 · src/sorted.bend:169

import bend-lawful-stdlib@0.1.0.0/src/sorted.bend as Sorted
import Base

169# how many elements of xs ~eq calls equal to y
170def count(~A: Data, ~eq: A -> A -> Bool, +y: A, xs: List<&2, A>) -> Nat:
171  match xs:
172    case Nil{}:
173      0n
174    case h <> t:
175      bump(eq(y, h), count(~A, ~eq, y, t))

Uses (4)

Used by (3)