![]() |
.. (לתיקייה המכילה) | |
Can we use auxiliary functions? | |
Yes, with the exceptions mentioned in the exercise. For instance, in question 2e-g, the use of any function converting from s_expr to a different representation is prohibited. |
in question 2, is the digit '1' a number? | |
The digit '1' happens to have the same structure as the number zero. So in that sense yes. The intention of the question was that you don't need to have special cases for digits '0' and '1'. So the digit '1' shouldn't be treated as the number one and digit '0' shouldn't be treated as the number zero. |
For splitswith of an empty switchlist we receive a warning, is that ok? | |
You are allowed to ignore the warning: " Warning: type vars not generalized because of value restriction are instantiated to dummy types (X1,X2,...)" |
Should ('a,'b) switchlist contain elements of type 'a at even place and 'b at odd | |
The point of the question is that that the two types 'a and 'b will be interleaved and for both options no point reduction will occur. It will be preferable that 'a will be in odd places (first third an so on) and 'b in even ( second, forth and so on) |
A recommendation with a hint for an intuition simplifying question 2. | |
It is recommended that you implement a function from int list to s_expr which takes a list such as [1,0,1,0] and converts it to a bin number. You are not allowed to use it in any of the functions for submission, but it should make it easier to debug your functions. |
In question 2e what should we return in case of an error? | |
As is implied from the published test, in case of an error appendBinNumbers should return NIL. |
Do we need to define the operator (.) in question 2? | |
No. |
In the example why should "sumBinNumbers one one ;" be CONS(CONS(NIL,NIL),NIL)? | |
Please note the difference between a binary number and a digit. The identifier one holds the DIGIT 1 not the number. The digit 1 has the same structure as the number 0. You need to handle only numbers all other inputs are illegal. so 0+0 is 0. |
Is the number zero a legitimate binary number? | |
Yes. It is a legitimate binary number that is not considered to contain leading zeroes. The digit 0 is not a legitimate number. The digit 1 happens to have the same structure as the number zero so it should be handled as the number zero if given as input. |