fun map (f, lst) =
case lst of
[] => []
| x::xs => f x :: map (f,xs)
fun filter (f, lst) =
case lst of
[] => []
| x::xs => if f x
then x::filter (f, xs)
else filter (f, xs)
fun piecewise x = if x < 0.0
then fn x => x*x
else if x < 10.0
then fn x => x / 2.0
else fn x => 1.0 / x + x