From: skaller <sk...@us...> - 2005-08-10 00:56:34
|
On Tue, 2005-08-09 at 19:46 -0500, Brian Hurt wrote: >=20 > I don't think we need an exception to do this. Wouldn't this do: >=20 > let fold_left_while f p init lst =3D > let rec loop accu =3D function > | h :: t -> > if p h then loop (f accu h) t else accu > | [] -> accu > in > loop init lst > ;; Yes, that's good! > >> The second function is called split. > > > > List.split already exists, it splits a list of pairs > > into two lists, perhaps call it "part"? (short for > > partition .. but that isn't quite accurate). >=20 > List.partition already exists as well. Hence 'part' rather than 'partition'.. but a better name would be good. --=20 John Skaller <skaller at users dot sourceforge dot net> |