List.splitOn #
The original list L can be recovered by flattening the lists produced by splitOnP p L,
interspersed with the elements L.filter p.
theorem
List.splitOnP_first
{α : Type u_1}
(p : α → Bool)
(xs : List α)
(h : ∀ (x : α), x ∈ xs → ¬p x = true)
(sep : α)
(hsep : p sep = true)
(as : List α)
:
When a list of the form [...xs, sep, ...as] is split on p, the first element is xs,
assuming no element in xs satisfies p but sep does satisfy p
intercalate [x] is the left inverse of splitOn x