Question: In Scheme, Write a higher order function called filter-list. This filter-list function is a higher order function which means that it takes a function as
In Scheme,
Write a higher order function called filter-list. This filter-list function is a higher order function which means that it takes a function as a parameter and calls it as part of its execution. The filter-list function takes a function as a parameter and a list as a parameter. The function parameter should be a function that takes a single parameter and returns #t or #f. The list parameter is a list.
The filter-list function returns a list of all the items from the list parameter that result with a #t from the function passed in.
Example:
(define greater-than-10 (lambda (num) (if (> num 10)
#t
#f)))
(filter-list greater-than-10 '( 2 3 4 5 6 7 8 9 10 11 12 13)) (11 12 13)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
