def list.ones

bend-kit-property@0.4.0.0 · shrink.bend:81

import bend-kit-property@0.4.0.0/shrink.bend as Shrink
import Base

81# One element replaced by one of its candidates: the head's first, then the tail's.
82def list.ones(~A: Data, ~shrink: A -> List<&1, A>, +xs: List<&2, A>) -> List<&1, List<&2, A>>:
83  match xs:
84    case Nil{}:
85      Nil{}
86    case h <> t:
87      List.append(&1, List<&2, A>, list.heads(A, shrink(h), t),
88        list.cons(A, h, list.ones(~A, ~shrink, t)))

Uses (4)

Used by (1)