I am trying to write a procedure that returns a closure. I want to be able to apply any procedure to my series. This is what I have so far and it is not working for me.
(define (forAll n m)
(lambda (op start)
(op (op n start) (+ n 1) m)))
I want to be able to do these operations:
(define my_iterator (forAll 1 5))
(my_iterator + 0) → 15
(my_iterator * 1) → 120
(my_iterator (lambda (x y) (display x)(display " ")) "") → 1 2 3 4 5