![]() |
.. (לתיקייה המכילה) | |
In question 1.a: What should the functions return when they receive an empty lseq? | |
The functions should not return a value - they should raise an exception. Then, if someone uses these functions they can define handles for the exceptions and in this manner decide what will be done with empty lseqs. |
In question 1.a: Do we need to write handles for the exceptions or just raise them? | |
In the functions lhead and ltail there can be no handles for the exceptions. The exceptions are raised in the cases where the functions don't know how to handle the situation. Handles can be defined in functions that use lhead and ltail. Therefore, when you use these functions to define lget in 1.b you may need to define handles. |
In question 2.a: What do you mean by "define s..."? | |
Prolog's response for s(0), s(s(0)), s(s(s(0)))... should be yes. |
In question 3.b and 3.c: When making modifications to the procedure can we change the parameter line? What do we need to preserve? | |
No, you may not change the parameter line because this would change the functionality of the procedure. You need to make modifications to the body of the procedure so that the functionality is maintained (with respect to one of the evaluation orders). |