Question: Common Lisp questions. Plz answer all. sp-Assignment-4 pdf m 12 v alli SECTION 2 (Main Problems) Your solutions to the following problems will count a
sp-Assignment-4 pdf m 12 v alli SECTION 2 (Main Problems) Your solutions to the following problems will count a total of 2% towards your grade if the grade is computed using rule A. Note that a working solution to each of problems 1-7 can be obtained from a solution to the corresponding one of problems A -G by changing the name of the function MY-FUNC to FUNC and adding appropriate base case code, without changing the LET block. If your base case code is correct but the resulting definition of FUNC is incorrect, then your definition of MY-FUNC was incorrect. This is because FUNC will return the same result as MY-FUNC would have returned in all non-base cases where the recursive call of FUNC returns the correct result: So if MY-FUNC was correct then FUNC will return the correct result in all non-base cases where the recursive call of FUNC returns the correct result. But if you solve a problem this way then you are expected to move out of the LET any cases that do not need to use the LET's local variable, and to eliminate the LET if the value of its local variable is never used more than once. Warning: On euclid and venus, when you LOAD a function definition for any of problems 1-7, your SUM for problem 1 is wrong then, after you LOAD your definition of SUM, your definition of MY-SUM Note: You may use ENDP or NULL to test whether a list is empty. Recall that (ENDP L)-(NULL L) if function will replace the predefined function that has the same name. So if, for example, your definition of for problem A (which calls SUM) may stop working until you restart Clisp, even if it is correct. the argument is a list. An evaluation error occurs if ENDP is called with an argument that is not a list. not a valid argument of MY-SUM, NIL is a valid argument of SUM. is a valid argument of NEG-NUMS argument of INC-LIST-2 may be NIL argument of INSERT may be NIL 1. Define a recursive function SUM with the properties stated in problem A. Note that whereas NIL is 2. Define a recursive function NEGNUMS with the properties stated in problem B. Note that NIL 3. Define a recursive function INC-LIST-2 with the properties stated in problem C. Note that the first 4. Define a recursive function INSERT with the properties stated in problem D. Note that the second 5. Define a recursive function ISORT with the properties stated in problem E. Hint: In your definition of ISORT you should not have to call any function other than ISORT itself, INSERT, CAR, CDR, and ENDP. (A special form such as IF or COND is not considered to be a function, and will be needed.) LISP Assignment 4: Page 3 of 1ER1 9 C
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
