Answered step by step
Verified Expert Solution
Question
1 Approved Answer
8. Define a LISP function SAME-PARITY with the following properties. SAME-PARITY takes two arguments. It returns T if both arguments are even integers or if
8. Define a LISP function SAME-PARITY with the following properties. SAME-PARITY takes two arguments. It returns T if both arguments are even integers or if both arguments are odd integers. In all other cases SAME-PARITY returns NIL Examples: (SAME-PARITY 0-1)=> NIL (SAME-PARITY-3-9)=>T (SAME-PARITY 30 90)=>T SAME-PARITY 'A 'A) => NIL (SAME-PARITY 4.1 3.7)-> 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 does not satisfy ZEROP, then the function returns the result of dividing the first argument by the second. In all other cases it returnsNL. Examples: (SAFE-DIV 6 4)-> 3/2 (SAFE-DIV 6.0 4)=> 1.5 (SAFE-DIV 6 0)-> NIL (SAFE-DIV 6 0.0)=> NIL (SAFE-DIV 16) 4)=> NIL (SAFE-DIV 6 T)=> NIL 8. Define a LISP function SAME-PARITY with the following properties. SAME-PARITY takes two arguments. It returns T if both arguments are even integers or if both arguments are odd integers. In all other cases SAME-PARITY returns NIL Examples: (SAME-PARITY 0-1)=> NIL (SAME-PARITY-3-9)=>T (SAME-PARITY 30 90)=>T SAME-PARITY 'A 'A) => NIL (SAME-PARITY 4.1 3.7)-> 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 does not satisfy ZEROP, then the function returns the result of dividing the first argument by the second. In all other cases it returnsNL. Examples: (SAFE-DIV 6 4)-> 3/2 (SAFE-DIV 6.0 4)=> 1.5 (SAFE-DIV 6 0)-> NIL (SAFE-DIV 6 0.0)=> NIL (SAFE-DIV 16) 4)=> NIL (SAFE-DIV 6 T)=> NIL
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started