(= foo (fn ...))
(def accumulate (combiner null-value term a next b) (def iter (a result) ...
What you want to do is:
(def accumulate (combiner null-value term a next b) (let iter (fn (a result) ....
Arc:
arc> (def fn2() (def i() (prn "fn2-i")) (i)) #<procedure: fn2> arc> (fn2) fn2-i "fn2-i" arc> (def fn1() (def i() (prn-"fn1-i")) (fn2) (i)) #<procedure: fn1> arc> (fn1) *** redefining i *** redefining i fn2-i fn2-i "fn2-i"
> (define (fn2) (define (i) (print "fn2-i")) (i)) > (fn2) "fn2-i"> (define (fn1) (define (i) (print "fn1-i")) (fn2) (i)) > (fn1) "fn2-i""fn1-i">
-----