def occurrences

bend-collections-laws-math@1.0.0.0 · spec/math/random/rand.bend:111

import bend-collections-laws-math@1.0.0.0/spec/math/random/rand.bend as Rand
import Base

111def occurrences(~A: Data, ~V: Data, ~rel: A -> V -> Bool, +v: V, xs: List<&2, A>) -> Nat:
112  match xs:
113    case Nil{}:
114      0n
115    case Con{+x, rest}:
116      Nat.add(b2n(rel(x, v)), occurrences(~A, ~V, ~rel, v, rest))

Uses (5)

Used by (6)