One other thing I noticed when reading contify is the definition of partition. Here is a faster one. fun partition (l, p) = List.fold (l, {no = [], yes = []}, fn (x, {no, yes}) => if p x then {no = no, yes = x :: yes} else {no = x :: no, yes = yes}) If order matters, then add a rev before calling it. I'm adding this to list.sig and list.sml (it used to be there, but got deleted during some reorg).