Question: GUIDELINES For each part you must: Write a LISP program Test, debug, and execute the LISP program a. b. 1. a) Write a function that

 GUIDELINES For each part you must: Write a LISP program Test,

GUIDELINES For each part you must: Write a LISP program Test, debug, and execute the LISP program a. b. 1. a) Write a function that takes any two inputs and makes a list of them using CONS b) Write a function that takes four inputs and returns a two-element nested list. The first element should be a list of the first two inputs, and the second element a list of the last two inputs. c) Define a function MILES-PER-GALLON that takes three inputs, called INITIAL- ODOMETER-READING, FINAL-ODOMETER-READING, and GALLONS-CONSUMED and computes the number of miles traveled per gallon of gas. d) Write a predicate FIRSTP that returns T if its first argument (a symbol) is equal to the first element of its second argument (a list). That is, (FIRSTP 'Foo '(FOO BAR BAZ)) should return T. (FIRSTP 'BOING '(FOO BAR BAZ)) should return NIL e) Write a function MID-ADD1 that adds 1 to the middle element of a three-element list. For example, (MID-ADD (TAKE 2 COOKIES)) should return the list (TAKE 3 COOKIES). Note: You are not allowed to make MID-ADD1 a function of three inputs. It has to take a single input that is a list of three elements f) Write a function F-TO-C that converts a temperature from Fahrenheit to Celsius. The formula for doing the conversion is: Celsius temperature-5x (Fahrenheit temperature-32)/9. To go in the opposite direction, the formula is: Fahrenheit temperature -(9/5x Celsius temperature) + 32. GUIDELINES For each part you must: Write a LISP program Test, debug, and execute the LISP program a. b. 1. a) Write a function that takes any two inputs and makes a list of them using CONS b) Write a function that takes four inputs and returns a two-element nested list. The first element should be a list of the first two inputs, and the second element a list of the last two inputs. c) Define a function MILES-PER-GALLON that takes three inputs, called INITIAL- ODOMETER-READING, FINAL-ODOMETER-READING, and GALLONS-CONSUMED and computes the number of miles traveled per gallon of gas. d) Write a predicate FIRSTP that returns T if its first argument (a symbol) is equal to the first element of its second argument (a list). That is, (FIRSTP 'Foo '(FOO BAR BAZ)) should return T. (FIRSTP 'BOING '(FOO BAR BAZ)) should return NIL e) Write a function MID-ADD1 that adds 1 to the middle element of a three-element list. For example, (MID-ADD (TAKE 2 COOKIES)) should return the list (TAKE 3 COOKIES). Note: You are not allowed to make MID-ADD1 a function of three inputs. It has to take a single input that is a list of three elements f) Write a function F-TO-C that converts a temperature from Fahrenheit to Celsius. The formula for doing the conversion is: Celsius temperature-5x (Fahrenheit temperature-32)/9. To go in the opposite direction, the formula is: Fahrenheit temperature -(9/5x Celsius temperature) + 32

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!