Write the following functions in LISP: (sumpositive L) which only adds positive numbers in a given...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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: 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:
Expert Answer:
Related Book For
Accounting for Governmental and Nonprofit Entities
ISBN: 978-1259917059
18th edition
Authors: Jacqueline L. Reck, James E. Rooks, Suzanne Lowensohn, Daniel Neely
Posted Date:
Students also viewed these programming questions
-
CANMNMM January of this year. (a) Each item will be held in a record. Describe all the data structures that must refer to these records to implement the required functionality. Describe all the...
-
Q1. You have identified a market opportunity for home media players that would cater for older members of the population. Many older people have difficulty in understanding the operating principles...
-
Does the fact that the strategic petroleum reserve has never been used to offset shortfalls caused by an embargo mean that the money spent in creating the reserve has been wasted? Why or why not?
-
Amy Dyken, controller at Fitzgerald Pharmaceutical Industries, a public company, is currently preparing the calculation for basic and diluted earnings per share and the related disclosure for...
-
1. What do you recommend that leadership at Luxury Design do to facilitate having a disrupter within the company? 2. What thought should Arianna and the other members of the leadership team at Luxury...
-
Indicate the specific accounting control objectives for each function in the execution of manufacturing transactions.
-
Identify audit tests that may be used as alternative audit procedures when a response is not received for a positive confirmation request. Compare and contrast the quality of audit evidence yielded...
-
Given 6 Lf(x) dx = 7 and [f(x) dx = -3 evaluate each definite integral. 6 (a) 1 f(x) dx = [ 3 f(x) dx = (b) [ f(x) (c) 3 f(x) dx = = LRON- Lf(x) 3 (d) 6 -10f(x) dx = [ 3
-
Reba Dixon is a fifth-grade school teacher who earned a salary of $38,000 in 2019. She is 45 years old and has been divorced for four years. She receives $1,200 of alimony payments each month from...
-
Compare and contrast business with financial risk. Explain how leverage is achieved in both the business and financial risk context and detail the types of firms that should have more and less...
-
Derby State University is a four-year public institution of higher education that features a robust and award-winning STEM curriculum. Located in the Southern United States, the heritage of...
-
Police officers are called to the house at 268 South Main Street after a neighbor notices newspapers piling up at the front door. The house is occupied by Carl, his wife Becca, and two small...
-
What is your understanding of the relevance of research within forensic psychology? Describe how the three basic research designs could be used in forensic psychology research. Explain the strengths...
-
At the hearing on 30 January 2017, none of the parties was able to produce a copy of the contract which was the subject of the dispute. I took all of the parties' oral evidence, and received their...
-
After reviewing the Specialty Guidelines for Forensic Psychology (2013), please select one of the 11 domains (i.e. responsibilities, competence, etc.) that you could see leading to ethical problems...
-
3. Suppose the graph below represents domestic supply of Good Z in autarky and domestic demand for Good Z for Country Lambda. Assume that Country Lambda is a small nation relative to the rest of the...
-
Software Solution is family-owned business that has been in operation for more than 15 year. The board of directors is comprised of mainly family members, plus a few professionals such as an...
-
The Art League is a not-for-profit organization dedicated to promoting the arts within the community. There are two programs conducted by the Art League: (1) exhibition and sales of members art...
-
Using GP for general purpose government or SP for special purpose government, identify the following governments by type. a. Stonington Village. b. Lynnford Regional Library District. c. Hillsborough...
-
Use Illustration 134 as a guide in completing this exercise. 1. Fredericksburg Chamber of Commerce 2. American Diabetes Association 3. American Legion 4. American Museum of Natural History 5....
-
A printed circuit board of mass \(1 \mathrm{~kg}\) is supported to the base through an undamped isolator. During shipping, the base is subjected to a harmonic disturbance (motion) of amplitude \(2...
-
An electronic instrument of mass \(10 \mathrm{~kg}\) is mounted on an isolation pad. If the base of the isolation pad is subjected to a shock in the form of a step velocity of \(10 \mathrm{~mm} /...
-
A viscously damped single-degree-of-freedom system has a body of mass \(25 \mathrm{~kg}\) with a spring constant of \(70 \mathrm{kN} / \mathrm{m}\). Its base is subjected to harmonic vibration. (a)...
Study smarter with the SolutionInn App