Question: EnvironmentRACKET S.separate Define a function that takes a procedure that executes a Boolean test on an atomic value and a list of elements as arguments.


EnvironmentRACKET S.separate Define a function that takes a procedure that executes a Boolean test on an atomic value and a list of elements as arguments. It should returns a list containing two sublists, the first sublist containing the elements from the original list in which each member passes the Boolean test as True, and the second sublist containing the elements from the original list in which each member passes the Boolean test as False. You may not use the built-in filter function as a helper function. You may define your own helper functions. Your implementation must be recursive. Input: A function that takes a single element and returns a Boolean, and a lists of elements. Output: A new list with two sublists. The first sublist contains the even numbers from the original list and the second sublist contains the odd numbers. Example: (separate even? '(7235 8) ((28) (73 5)) (separate integer?(3.0-5.2 8 16 99.7)) ((8 16) (3.0 -5.2 99.7) > (separate real?O) 6. is-member? Define a function that takes two arguments, a list and an expression, which may be atomic or a list. Your function should return true (#1) if the element is a member of the list and false (#f) if it does not. You may not use the built-in member orelement functions as helper functions. Your Input: A list of elements of a ny data type, potentially heterogenous and a single atom of any data type Output: A boolean value that indicates whether the input atom is a member of the input list. Example: (is-member?6 '(4 8621)) (is-member?7 '(4 8621)) #f (is-member? #t "foo" ' (4 5 #f "foo" a)) (is-member? #t " (3 4) ' (4 5 #f "foo" (3 4)))
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
