fun mystery(a, b::bs) =
if a = b then
mystery(a, bs)
else
b::mystery(a, bs)
| mystery(a, []) = [];
What is the type of mystery? What is the value of mystery(3,[3,2,1,2,3])? What happens if you try mystery(3.0,[3.0,2.0])? Why?
irr for int*real->real.foldr and map can be used in ML to start with
the list [4,5,6] and produce the list [8,8,10,10,12,12],
in which each value has been "doubled" in two senses of the word:
multiplied by two and repeated twice.