def insert.go

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

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

33# insert's step after comparing x with h. The recursive insert is passed
34# as a thunk so that the x-first branch does not run it.
35def insert.go(-A: Data, -o: C.Ord<A>, x: A, h: A, t: List<&2, A>, rec: Unit -> List<&2, A>, c: Or(C.Ord.R(A, o, x, h), C.Ord.R(A, o, h, x))) -> List<&2, A>:
36  match c:
37    case Inl{e}:
38      x <> h <> t
39    case Inr{e}:
40      h <> rec(Unit{})

Uses (6)

Used by (4)