fun elim(x, []) = []
| elim(x, y::L) = if x = y then elim(x,L) else y::(elim(x,L));
For each of the following expressions, say what is the result (including error).
Remember that the two arguments of "=" must have the same type, and that it must be an equality type.
datatype tree = empty | node of (tree * int * tree);
fun f empty = 0
| f (node(t1,n,t2)) = if (f t1) > (f t2) then 1 + (f t1) else 1 + (f t2);
Say what is the semantics of f (only one answer, please)
fun reduce(f, v, []) = v
| reduce(f, v, x::L) = f(x, reduce(f,v,L));
fun append([],L) = L
| append(x::K,L) = x::append(K,L);
Say what is the result of the following
expression (only one answer, please)
reduce(append, [], [[1,2],[3],[],[4,5]]);