Question
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
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