Question: 1. Write a function in Scheme that accepts 3 parameters and counts the number of values in a specified range (low to high) which
1. Write a function in Scheme that accepts 3 parameters and counts the number of values in a specified range (low to high) which are divisible by a third parameter. Example: (count 1 12 3) would resolve to 4 because there are 4 values from 1 to 12 which are dividable by 3. o 2. Write a function in Scheme that counts the number of values in a list that are divisible by 2. o Example: (count' (1 2 3 4 5 6 7 8 9 10 11 12) 3) would resolve to 4 because there are 4 values in the list which are dividable by 3. 3. Rewrite each of the above so that they accept a "Predicate function" which can be used to determine whether an item should be counted or not. o Example: (count 1 12 (lambda (a) (= (modulo a 2) 0)) would resolve to 4
Step by Step Solution
3.48 Rating (148 Votes )
There are 3 Steps involved in it
To tackle these tasks well be writing Scheme functions that respectively count the number of values within a specified range or list that are divisibl... View full answer
Get step-by-step solutions from verified subject matter experts
