I'm trying to create a Scheme program (Language R5RS) which applies an operation to a set of lists, depending on how big a number is on a list.
So the function looks like
(apply-function f g)
The condition is, if f(a b) where a < 5, then apply operation f(a b).
But if a is equal or greater than 5, apply g(a b). (The second operation)
This sounds confusing but a visual example should clear it up: So, an example would be
((apply-function '* '+) '((2 3) (8 6)))
Would return:
'(6 14)
Another example would be
((apply-function '* '+) '((5 7) (2 3) (3 3))
Returns
'(12 6 9)
I've tackled operations on Scheme before, but the condition part is throwing me off and I'm not sure where to start. Any help is appreciated!