![]() |
.. (לתיקייה המכילה) | |
In question 1, when calculating the sum of sqrt of numbers, can we assume that the numbers are integers and not reals?
Also, can we assume that they're positive?
|
No, the numbers are integers, like in HW1. You can convert an integer to a real number using the real() function. You may assume that the numbers are positive. If you want, you can also convert them to positive numbers using abs(). |
May we ignore "Warning: calling polyEqual" warnings?
|
Yes. This warning doesn't indicate any real problem with the code. You can also try turning these warnings off with the command: "Control.polyEqWarn := false" |
Since there is no "absolute" neutral element for the step function that finds the earliest string, how can we solve question 1c for it?
| You don't need to solve question 1c for this step function. |
In question 4, can we define helper variables using let (let val x=...)?
| No, you may not. |
What is the complexity of the operators @ and ::?
|
The complexity of operator :: is O(1). Regarding operator @, you can see its implementation in the tutorial slides. |
In question 5a, can we implement a curried function that receives 4 parameters?
| No, you must implement a function that receives exactly 3 parameters (i.e.: fun dcompose f g n = ...) |
In question 4, can we assume that the elements in the list are unique?
|
No. For example, the following list is perfectly legitimate: [10,30,50,10,30,50]. The output should be: mySort op< [10,30,50,10,30,50] = [10,10,30,30,50,50]. |
My function gets a "Warning: match nonexhaustive" warning, but I know that it works correctly in all cases.
|
Please add a "default" case to avoid getting warnings anyway. You can return any value you like. for example: f (x::xs) a b c =... | f _ _ _ = [] |

