fun testEven([]) = [] | testEven(x::rest) = (x mod 2 = 0) :: testEven(rest); fun scale(f, []) = [] | scale(f, x::rest) = x * f :: scale(f, rest); fun makeReals([]) = [] | makeReals(x::rest) = real(x)::makeReals(rest); fun listify([]) = [] | listify(x::rest) = [x]::listify(rest); fun applyFunToList(f, []) = [] | applyFunToList(f, a::rest) = f(a)::applyFunToList(f, rest); fun map(f, []) = [] | map(f, a::rest) = f(a)::map(f, rest); fun testEven(xx) = map(fn (x) => x mod 2 = 0, xx); fun scale(f, xx) = map (fn (x) => f * x, xx); fun makeReals(xx) = map(real, xx); fun listify(xx) = map(fn(x) => [x], xx); fun keepEvens([]) = [] | keepEvens(a::rest) = if a mod 2 = 0 then a::keepEvens(rest) else keepEvens(rest); fun contains(x, []) = false | contains(x, y::rest) = x = y orelse contains(x, rest); fun intersection([], bb) = [] | intersection(a::rest, bb) = if contains(a, bb) then a::intersection(rest, bb) else intersection(rest, bb); fun filter(f, []) = [] | filter(f, a::rest) = if f(a) then a::filter(f, rest) else filter(f, rest); fun keepEvens(xx) = filter(fn(x) => x mod 2 = 0, xx); fun intersection(aa, bb) = filter(fn(x) => contains(x, bb), aa);