Question: [RACKET CODING RECURSIVE] (just question 2 please) 1. Write a Racket function (member? x L) that tests whether x E L where L is a

[RACKET CODING RECURSIVE] (just question 2 please)

[RACKET CODING RECURSIVE] (just question 2 please) 1. Write a Racket function

1. Write a Racket function (member? x L) that tests whether x E L where L is a set (represented as a list). (Hint: x E L if and only if either x is equal to the head of L, or x is in the remainder of L.) Test cases: (member? 1 '(3 2 1)) ---> #t (member? 4 '(3 2 1)) ---> #f (member? i '())---> #f (member? 'susan '(susan john ryan)) ---> #t 2. Write a Racket function (subset? L1 L2) that tests whether L, SL . L1 is a subset of L2 if every element of L1 is also a member of L2. Test cases: (subset? '(1 2 3) '(3 2 1))---> #t (subset? '(1 2 3 '(4 5 6)) ---> #f (subset? '(1 2 3) '(1 2 3 4 5 6)) ---> (subset? '(1 2) '()---> #f #t ***Use the function (member? x L) as a helper function in your implementation. 1. Write a Racket function (member? x L) that tests whether x E L where L is a set (represented as a list). (Hint: x E L if and only if either x is equal to the head of L, or x is in the remainder of L.) Test cases: (member? 1 '(3 2 1)) ---> #t (member? 4 '(3 2 1)) ---> #f (member? i '())---> #f (member? 'susan '(susan john ryan)) ---> #t 2. Write a Racket function (subset? L1 L2) that tests whether L, SL . L1 is a subset of L2 if every element of L1 is also a member of L2. Test cases: (subset? '(1 2 3) '(3 2 1))---> #t (subset? '(1 2 3 '(4 5 6)) ---> #f (subset? '(1 2 3) '(1 2 3 4 5 6)) ---> (subset? '(1 2) '()---> #f #t ***Use the function (member? x L) as a helper function in your implementation

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!