Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Solve problems 7, 8, and 9 without using COND, IF, WHEN, UNLESS, or CASE. 7. Define a LISP function GT with the following properties. GT

image text in transcribed
Solve problems 7, 8, and 9 without using COND, IF, WHEN, UNLESS, or CASE. 7. Define a LISP function GT with the following properties. GT takes two arguments. It returns T if both arguments are numbers and the first argument is strictly greater than the second. In all other cases GT returns NIL LISP Assignment 3: Page 2 of 3 8. Define a LISP function SAME-SIGN with the following properties. SAME-SIGN takes two arguments. It 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-9)-> T (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 6.0 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

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions