Reputation: 101
(F n m l f g): n and m are natural numbers, l a list of numbers, f and g functions that take a numeric parameter and return a number. The F function should return:
I need to program this function in scheme. And I have developed a function for the product but not how to perform the evaluation of the role, I tried with the eval command but not worked yet
Any help on how to do?
Upvotes: 0
Views: 154
Reputation: 223183
Here's a straightforward translation of your formula to Racket:
(define (F n m l f g)
(for/sum ([i (in-range 1 (add1 n))])
(- (f (expt m i))
(g (for/product ([j (in-list l)])
(expt j i))))))
Upvotes: 6