- fun add (x,y) = x + y; - fun addR (x : real, y : real) = x + y; - fun count x = if null(x) then 0 else 1 + count(tl(x)); - fun count ([]) = 0 | count(h::t) = 1 + count(t); - fun append(x,z) = if null(x) then z else hd(x)::append(tl(x),z); - fun append ([], z) = z | append (h::t,z) = h::append(t,z); - fun member(x,[]) = false | member(x,b::y) = if x=b then true else member(x,y); - fun int ([],l1) = [] | int (h::l1,l2) = if member(h,l2) then h:: int(l1,l2) else int(l1,l2); - fun gcd (u,v) = if v = 0 then u else gcd(v, u mod v); - fun gcd u v = if v = 0 then u else gcd v (u mod v); - fun map f [] = [] | map f (h::t) = f(h):: map f t;