Question: 1. Define a LISP function MIN-2 with the following properties. MIN-2 takes two arguments. If those arguments have values A and B, and A and

 1. Define a LISP function MIN-2 with the following properties. MIN-2

1. Define a LISP function MIN-2 with the following properties. MIN-2 takes two arguments. If those arguments have values A and B, and A and B are numbers, then MIN-2 returns A ifASB and returns Bif A> B; but if A or B is not a number MIN-2 returns the symbol ERROR. Examples: (MIN-2 21.3 7/2) -> 7/2 (MIN-2 17.5 29) 17.5 (MIN-2 "(31)(54)) => ERROR (MIN-2 5 'APPLE)-> ERROR LISP Assignment 3: Page 1 of3 2.JExercise 4 on page 72 of Wilensky] Write a LISP function SAFE-AVG that takes 2 arguments and returns the average of those arguments if they are numbers. If one or both of the arguments is not a number, the function should return NIL Examples: (SAFE-AVG 23 47.4) 35.2 (SAFE-AVG 3 8112 SAFE-AVG (23.1) 47.3) NIL (SAFE-AVG 'ORANGE PLUM) NIL 3.IExercise 2 on page 72 of Wilenskyl Write a LISP predicate ODD-GT-MILLION that takes one argument, and which returns T if its argument is an odd integer greater than a million, but returns NIL otherwise. Hint: Make use of the predicate INTEGERP. Examples: ODD-GT-MILLION 92010231)T (ODD-GT-MILLION 17)>NIL (ODD-GT-MILLION 92010232)NIL ODD-GT-MILLION 21/5) NIL ODD-GT-MILLION (2010231)) NIL (ODD-GT-MILLION APPLE) NIL (ODD-GT-MILLION 1718671.24) NIL

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

LISP Function Definitions Here are the requested LISP function definitions based on the problem statement 1 MIN2 Function The function MIN2 takes two ... View full answer

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!