Question: Program in RACKET 5. classify Define a function that takes a procedure that executes a Boolean test on an atomic value and a list of

Program in RACKET

Program in RACKET 5. classify Define a function that takes a procedure

5. classify 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 exactly two sublists. 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: Two arguments... (1) a function that takes a single element and returns a Boolean, and (2) a list of elements whose element types are compatible with the single element from the first argument. Output: A new list with two sublists. The first sublist contains the elements from the original list that return true (#t) and the second sublist contains the elements from the original list that return false (#). Example: > (classify even? '(7 2 3 5 8)) '((2 8) (7 3 5)) > (classify integer? '(3.0 -5.2 8 16 99.7)) '((3.0 8 16) (-5.2 99.7)) > (classify real? '()) (0)

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!