Question: Using lisp Implement the following functions in the same file, complete with short descriptions. Do not use loops for these functions (meaning, use recursion when

Using lisp

Implement the following functions in the same file, complete with short descriptions. Do not use loops for these functions (meaning, use recursion when needed), nor built-in functions that can solve the problem directly.

  • A function with a single parameter called prod-list that returns the product of the elements of a list. We can assume that the argument is a list containing only numbers. If the list is empty, the function should return 0. Hint: use recursion combined with the functions car and cdr.
  • A function called is-in-list that takes two parameters, the first being a list and the second a value, and returns true (t) if the value is in the list and false (nil) if not. Use the function equal to test for equality of two values.
  • A function called median taking 3 arguments and computing the median of them. For example, if the arguments are 5, 2 and 4, the median is 4. This function should not be recursive. Note that some of the arguments can be equal to each other: the median of 7, 3, and 7 is 7.

Evaluate all of these functions and show a few examples of testing them and comment out the results

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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!