epicours/Exam.md

340 B

Multiple insertion

# let rec split sep lst = 
	let rec aux acc current = function
		| [], [] -> acc
		| [], tail -> current :: acc
		| x::xs, _ -> 
			if sep x then
				aux (current::acc) [] (xs, [])
			else aux acc (x :: current) (xs, current)
	in aux [] [] (lst, [])
val split: ('a -> bool) -> 'a list -> 'a list list = <fun>