Add partial_min/max to libcore/cmp

Intended to prevent each user to write his own partial_min/max, possibly differing in slight details. @sfackler encouraged to PR this on IRC.

(Let's hope this works... First PR.)