Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the following functions in LISP: (sumpositive L) which only adds positive numbers in a given list: (1.5 pt) (sumpositive (1-2 3 4 -5))
Write the following functions in LISP: (sumpositive L) which only adds positive numbers in a given list: (1.5 pt) (sumpositive (1-2 3 4 -5)) 8 Answer: (multiplylists L1 L2) which takes elements from two lists one by one and multiplies them: (1.5 pt) (multiplylists (123) (4 5 6)) (4 10 18) Answer: (addinorder x L) which inserts in order a number x into an ordered list L: (1.5 pt) (addinorder 3 (1 2 4 5)) (12345) Answer: (removeparentheses L) which removes all inner parentheses from a list L: (1.5 pt) (removeparentheses (1 (2 3) (4 (5)))) (12345) Answer: (makepairs L) which makes an inner list with every two successive numbers: (1.5 pt) (makepairs (1 2 3 4 5 6) ((1 2) (34) (56)) (makepairs (1234567) ((1 2) (34) (56) (7)) Answer:
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Here are the functions implemented in LISP 1 sumpositive L This function adds only positive numbers ...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