Functional Programming (H) - 4.05 - Idiomatic Haskell

1.
let x = y + 2 y = x/3 in x+y

This code defines a pair of simultaneous equations. Will this work in Haskell?

2. What is the missing case clause in the following definition of a function to calculate the length of a Haskell list?

mylength l = case l of -- MISSING CLAUSE -- x:xs -> 1+mylength xs

3. In a Haskell guard expression, each of the guards evaluates to a Bool value, either True or False. What is the Bool value for the otherwise case?

4. Select which one of the following two let expressions will evaluate to the String

"prime minister"

5. Study the Haskell function f below. What does f() evaluate to?

f :: () -> String f () = let x = (Just Nothing) in case x of (Just _) -> "something" Nothing -> "nothing"