Zulip Chat Archive
Stream: general
Topic: in the library already?
Scott Morrison (Aug 13 2018 at 23:31):
Is this in the library somewhere?
def list.split_on_aux {α} [decidable_eq α] (a : α) : list α → list α → list (list α)
| [] l := [l.reverse]
| (h :: t) l := if h = a then
l.reverse :: (list.split_on_aux t [])
else
list.split_on_aux t (h :: l)
def list.split_on {α} [decidable_eq α] (a : α) : list α → list (list α)
| l := list.split_on_aux a l []
Last updated: May 02 2025 at 03:31 UTC