- Start time:
- Mi 03 Mai 2017 16:00:40
- End time:
- So 07 Mai 2017 18:00:40
- Safe tail (3 P)
- Write a function "safetail", that does the same thing as the standard "tail" function but also works on empty lists: "safetail" should return an empty list when called with an empty list. Give...
- List Comprehensions (3 P)
- Implement the following functions using list comprehensions. a) (1 P) A triple (x,y,z) is called Pythagorean Triple if the equation x^2+y^2=z^2 holds (for x>=1 and x<=y). Write a...
- Pattern Matching (3 P)
- Implement three functions and2 , or2 and xor2 that implement the logic operations AND, OR and XOR respectively. You shall only use pattern matching for your...
- Currying & Sections (4 P)
- a) (1 P) Given the following function: f :: Fractional a => (a,a) -> a f t = (/) (fst t) (snd t) Write down the curried version of f including its type definition. b) (1...
- Recursion (3 P)
- Implement the following functions using recursion. Don't just delegate to standard prelude functions that might do the same thing! a) (1 P) repl :: Int -> a -> [a] returns a...