Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I need hlp with these assignment. It is a lisp assgnment the one really need is from question 1 trough 13. thank you C. INC-LIST-2
I need hlp with these assignment. It is a lisp assgnment the one really need is from question 1 trough 13. thank you
C. INC-LIST-2 is a function that is already defined on venus and euclid; ifL is any list of numbers and N is a number then (INC-LIST-2 L N) returns a list of the same length as L in which each element is equal to (N +the corresponding element of L). For example, (INC-LIST-2 ) 5)NIL (INC-LIST-2 13 2.1 1 7.9) 5)->(8 7.1 6 12.9) Complete the following definition of a function MY-INC-LIST-2 without making further calls of INC-LIST-2 and without calling MY-INC-LIST-2 recursively, in such a way that if L is any nonempty list of numbers and N is any number then (MY-INC-LIST-2 L N) is equal to (INC-LIST-2 LN). (defun my-inc-1ist-2 (L N (let (X (inc-list-2 (cdr L) N))) D. INSERT is a function that is already defined on venus and euclid; if N is any real number and L is any list of real numbers in ascending order then (INSERT N L) returns a list of numbers in ascending order obtained by inserting N in an appropriate position in L. Examples: (INSERT 8 ( ))-> (8) (INSERT410 0 1 2 4))-> (0 0 1 2 4 4) (INSERT 4"(0 0 1 3 3 7 8 8))-> (001334788) Complete the following definition of a function MY-INSERT without making further calls of INSERT and without calling MY-INSERT recursively, in such a way that if N is any real number and L is any nonempty list of real numbers in ascending order then (MY-INSERT N L) is equal to (INSERT N L). (defun my-insert (N L (let x insert (edr L))) [There are two cases: N may or may not be (car L). In the former case you do not need to use X, so if you move that case outside the LET the function will be more efficient.] E. ISORT is a function that is already defined on venus and euclid; if L is any list of real numbers then (ISORT L) is a list consisting of the elements of L in ascending order. Complete the following definition of a function MY-ISORT without making further calls of ISORT and without calling MY-ISORT recursively, in such a way that if L is any nonempty list of real numbers then (MY-ISORT L) is equal to (ISORT L). (defun my-isort (L) (let (X (isort cdr L)))) Hint: You should not have to call any function other than INSERT and CAR. IMPORTANT: If you have not yet done problems 15-20 of Lisp Assignment 2, do those six roblems before you work on the ne roblems! F. SPLIT-LIST is a function that is already defined on venus and euclid; if L is any list then (SPLIT-LIST L) returns a list of two lists, in which the first list consists of the 1st, 3d, 5t elements of L, and the second list consists of the 2d, 4th, 6th . elements of L. Examples: (SPLIT-LIST(NIL NIL) (SPLIT-LIST (ABCD12 345)((AC1 3 5) (B D 2 4)) (SPLIT-LIST (B CD 1 2 3 4 5)) ((B D24) (C13 5)) Complete the following definition of a function MY-SPLIT-LIST without making further calls of SPLIT-LIST and without calling MY-SPLIT-LIST recursively, in such a way that ifL is any nonempty list then (MY-SPLIT-LIST L) is equal to (SPLIT-LIST L). SPLIT-LIST (A))>((A) NIL) (defun my-split-list (L) (let ((X (split-list (edr L))) C. INC-LIST-2 is a function that is already defined on venus and euclid; ifL is any list of numbers and N is a number then (INC-LIST-2 L N) returns a list of the same length as L in which each element is equal to (N +the corresponding element of L). For example, (INC-LIST-2 ) 5)NIL (INC-LIST-2 13 2.1 1 7.9) 5)->(8 7.1 6 12.9) Complete the following definition of a function MY-INC-LIST-2 without making further calls of INC-LIST-2 and without calling MY-INC-LIST-2 recursively, in such a way that if L is any nonempty list of numbers and N is any number then (MY-INC-LIST-2 L N) is equal to (INC-LIST-2 LN). (defun my-inc-1ist-2 (L N (let (X (inc-list-2 (cdr L) N))) D. INSERT is a function that is already defined on venus and euclid; if N is any real number and L is any list of real numbers in ascending order then (INSERT N L) returns a list of numbers in ascending order obtained by inserting N in an appropriate position in L. Examples: (INSERT 8 ( ))-> (8) (INSERT410 0 1 2 4))-> (0 0 1 2 4 4) (INSERT 4"(0 0 1 3 3 7 8 8))-> (001334788) Complete the following definition of a function MY-INSERT without making further calls of INSERT and without calling MY-INSERT recursively, in such a way that if N is any real number and L is any nonempty list of real numbers in ascending order then (MY-INSERT N L) is equal to (INSERT N L). (defun my-insert (N L (let x insert (edr L))) [There are two cases: N may or may not be (car L). In the former case you do not need to use X, so if you move that case outside the LET the function will be more efficient.] E. ISORT is a function that is already defined on venus and euclid; if L is any list of real numbers then (ISORT L) is a list consisting of the elements of L in ascending order. Complete the following definition of a function MY-ISORT without making further calls of ISORT and without calling MY-ISORT recursively, in such a way that if L is any nonempty list of real numbers then (MY-ISORT L) is equal to (ISORT L). (defun my-isort (L) (let (X (isort cdr L)))) Hint: You should not have to call any function other than INSERT and CAR. IMPORTANT: If you have not yet done problems 15-20 of Lisp Assignment 2, do those six roblems before you work on the ne roblems! F. SPLIT-LIST is a function that is already defined on venus and euclid; if L is any list then (SPLIT-LIST L) returns a list of two lists, in which the first list consists of the 1st, 3d, 5t elements of L, and the second list consists of the 2d, 4th, 6th . elements of L. Examples: (SPLIT-LIST(NIL NIL) (SPLIT-LIST (ABCD12 345)((AC1 3 5) (B D 2 4)) (SPLIT-LIST (B CD 1 2 3 4 5)) ((B D24) (C13 5)) Complete the following definition of a function MY-SPLIT-LIST without making further calls of SPLIT-LIST and without calling MY-SPLIT-LIST recursively, in such a way that ifL is any nonempty list then (MY-SPLIT-LIST L) is equal to (SPLIT-LIST L). SPLIT-LIST (A))>((A) NIL) (defun my-split-list (L) (let ((X (split-list (edr L)))Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started