def insert
import bend-lawful-stdlib@0.1.0.0/src/sorted.bend as Sortedimport Base
import bend-lawful-stdlib@0.1.0.0/src/class.bend as C
42def insert(~A: Data, ~o: C.Ord<A>, +x: A, xs: List<&2, A>) -> List<&2, A>:
43 match xs:
44 case Nil{}:
45 [x]
46 case +h <> +t:
47 insert.go(A, o, x, h, t, u => insert(~A, ~o, x, t), C.Ord.dec(A, o, x, h))