Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

A greenlist is a non-empty list of pairs of integers where a pair of integers is a list of exactly two integer and where each

A greenlist is a non-empty list of pairs of integers where a pair of integers is a list of exactly two integer and where each pair ( x y) has the property that y x = 1.

Example: ( ( 5 6) ( 3 4) ( 2 3) ( -5 -4) ) is a greenlist.

The following items are not greenlists:

( ( 4 7) ( 9 10 ) ) , ( ( 4.5 5.5) ( 7 8) ) , ( ) ,

( ( 2 4 6) ( 5 6) ( 1 2)) , ( 3 4 5 6) , "green apples"

Write a Scheme predicate, ( greenlist? z) , hat returns #t if z is a greenlist; otherwise return #f. Check ALL conditions. Test your function on all of the above examples. [Hint: Create helper functions. ]

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

Concepts of Database Management

Authors: Philip J. Pratt, Joseph J. Adamski

7th edition

978-1111825911, 1111825912, 978-1133684374, 1133684378, 978-111182591

More Books

Students also viewed these Databases questions