copy from ch12
ordering functions
equality
if function