Functional Programming (H) - 1.10
1. Does the evaluation order of Haskell sub-expressions affect the overall value of the expression?
If expressions are evaluated in a different order, then the final value might be different.
No, evaluation order does not affect the final value.
2. What is the difference between a named function and a lambda function assigned to a variable? For example:
f x = x + 1 -- or f = \x -> x+1
It is less efficient to define functions in terms of lambdas.
There is no meaningful difference.
3. Given the definition:
sum_ratio = \x y z -> (x + y) / z
then what is the value of:
1 + 4* sum_ratio 4 2 3
5
9
4. What does the following expression evaluate to?
['a','d' .. 'z']
“adgjmpsvyâ€
“adzâ€
5. Given a list xs, what does the following expression evaluate to?
[]++xs == xs++[]
False
True
Submit Quiz