Question: 8. Define a LISP function SAME-SIGN with the following properties. SAME-SIGN takes two arguments. I returns T if both arguments are equal to zero, if
8. Define a LISP function SAME-SIGN with the following properties. SAME-SIGN takes two arguments. I returns T if both arguments are equal to zero, if both are negative numbers, or if both are positive numbers. In all other cases SAME-SIGN returns NIL Examples: (SAME-SIGN 0-2)NIL (SAME-SIGN-3-9T (SAME-SIGN'A 'A)NIL 9. Define a LISP function SAFE-DIV with the following properties. SAFE-DIV takes two arguments. If both arguments are numbers and the second is not equal to zero, then it returns the result of dividing the first argument by the second. In all other cases it returns NIL Examples: (SAFE-DIV 6 4)3/2 (SAFE-DIV 60 4)1.5 (SAFE-DIV 6 0)NIL SAFE-DIV 6 0.0) NIL (SAFE-DIV (6) 4NIL
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
