Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

PostgreSQL 10 High Performance Expert Techniques For Query Optimization High Availability And Efficient Database Maintenance

Authors: Ibrar Ahmed ,Gregory Smith ,Enrico Pirozzi

3rd Edition

1788474481, 978-1788474481

More Books

Students also viewed these Databases questions

Question

What could other companies learn from this example?

Answered: 1 week ago