Question: I need hlp with these assignment. It is a lisp assgnment the one really need is from question 1 trough 13. thank you Each element

 I need hlp with these assignment. It is a lisp assgnment

I need hlp with these assignment. It is a lisp assgnment the one really need is from question 1 trough 13. thank you

Each element of L must appear in the CAR or CADR of (PARTITION L P), and should appear there just as many times as in L. Examples: (PARTITION (7 5 3215)1)INIL (75 321 5) (PARTITION (4 0 5 31 2414) 4)-> ((0 3 12 1) (45 4 4)) (PARTITION O9)(NIL NIL) Complete the following definition of a function MY-PARTITION without making further calls of PARTITION and without calling MY-PARTITION recursively, in such a way that if L is any nonempty list of real numbers and P is a real number then (MY-PARTITION L P) is equal to (PARTITION L P). (defun my-partition (L P) (let ((xX (partition (cdr L) P) There are two cases: (car L) may or may not be less than P 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 the resulting definition of FUNC does not work, then either your base case code is incorrect, or your definition of MY-FUNC was incorrect-indeed, a minimal argument for which FUNC fails to work must either be a base case or be an argument for which MY-FUNC would also have failed to work.] 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 entirely 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 function will replace the predefined function that has the same name. So if, for example, your definition of SUM for problem 1 is wrong then, after you LOAD your definition of SUM, your definition of MY-SUNM for problem A (which calls SUM) may stop working until you restart Clisp, even if it is correct. 1. Define a recursive function SUM with the properties stated in problem A. Note that whereas NIL is 2. Define a recursive function NEG-NUMS 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 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 ISORT you should not have to call any function other than ISORT itself, INSERT, CAR, CDR, and 5. Define a recursive function ISORT with the properties stated in problem E. Hint: In your definition of 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 of5 Each element of L must appear in the CAR or CADR of (PARTITION L P), and should appear there just as many times as in L. Examples: (PARTITION (7 5 3215)1)INIL (75 321 5) (PARTITION (4 0 5 31 2414) 4)-> ((0 3 12 1) (45 4 4)) (PARTITION O9)(NIL NIL) Complete the following definition of a function MY-PARTITION without making further calls of PARTITION and without calling MY-PARTITION recursively, in such a way that if L is any nonempty list of real numbers and P is a real number then (MY-PARTITION L P) is equal to (PARTITION L P). (defun my-partition (L P) (let ((xX (partition (cdr L) P) There are two cases: (car L) may or may not be less than P 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 the resulting definition of FUNC does not work, then either your base case code is incorrect, or your definition of MY-FUNC was incorrect-indeed, a minimal argument for which FUNC fails to work must either be a base case or be an argument for which MY-FUNC would also have failed to work.] 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 entirely 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 function will replace the predefined function that has the same name. So if, for example, your definition of SUM for problem 1 is wrong then, after you LOAD your definition of SUM, your definition of MY-SUNM for problem A (which calls SUM) may stop working until you restart Clisp, even if it is correct. 1. Define a recursive function SUM with the properties stated in problem A. Note that whereas NIL is 2. Define a recursive function NEG-NUMS 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 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 ISORT you should not have to call any function other than ISORT itself, INSERT, CAR, CDR, and 5. Define a recursive function ISORT with the properties stated in problem E. Hint: In your definition of 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 of5

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To tackle this assignment lets break down each relevant section and solve it step by step Here are s... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!