Split a list at every element satisfying a predicate, and then prepend acc.reverse to the
first element of the result.
[1, 1, 2, 3, 2, 4, 4].splitOnPPrepend (· == 2) [0, 5] = [[5, 0, 1, 1], [3], [4, 4]]
Equations
Instances For
Split a list at every element satisfying a predicate. The separators are not in the result.
Examples:
[1, 1, 2, 3, 2, 4, 4].splitOnP (· == 2) = [[1, 1], [3], [4, 4]]
Equations
- List.splitOnP p l = List.splitOnPPrepend p l []
Instances For
@[deprecated List.splitOnPPrepend (since := "2026-02-26")]
Equations
- List.splitOnP.go p l acc = List.splitOnPPrepend p l acc
Instances For
@[inline]
Tail recursive version of splitOnP.
Equations
- List.splitOnPTR p l = List.splitOnPTR.go✝ p l #[] #[]
Instances For
@[inline]
Split a list at every occurrence of a separator element. The separators are not in the result.
Examples:
[1, 1, 2, 3, 2, 4, 4].splitOn 2 = [[1, 1], [3], [4, 4]]
Equations
- List.splitOn a as = List.splitOnP (fun (x : α) => x == a) as