Due: Dec 8, 1999
This is the final assignment for the quarter, and intended to be easy (since it's the end of the quarter and you also have projects due).
my_map2 (+) [1,2,3] [10,11,12]should evaluate to [11,13,15]. It is an error if the lists are of differing lengths. (Use the built-in function error in handling this.) There is a built-in map2 function in the Miranda standard library -- please write your own though.
smember [1,2,3] 3 returns True smember [10..] 5 returns False smember primes 11 returns True smember primes 10 returns Falsewhere primes is the infinite list of primes (defined elsewhere).
cube x = x*x*x my_map f [] = [] my_map f (x:xs) = f x : my_map f xs my_append [] x = x my_append (x:xs) ys = x : my_append xs ysWhat is the result of evaluating the following Miranda expressions? (If there is a compile-time type error, or a run-time error, or a non-terminating computation, say so.) If the expression is followed by :: then give the type, instead of the value.
cube 3 cube :: my_map :: my_map cube :: my_map cube [1..] my_append ::(You can check your answers by trying them with Miranda, but I recommend trying to figure it out by hand first, since there will be a similar question on the final.)