On May 5, 2009, at 5:07 PM, Marijn Schouten (hkBst) wrote:
The function
(define (walk-f depth)
(let step ((d 0) (x 0) (y 0) #;(z 0))
(cond ((< d depth)
(let ((d+1 (+ d 1)))
(+
(step d+1 (+ x 1) y)
(+
(step d+1 (- x 1) y)
(+ (step d+1 x (+ y 1))
(step d+1 x (- y 1))) ))))
(else
(L2-norm x y)))))
calculates the total squared length.
Wouldn't this be simpler and more efficient:
(define (walk-f n)
(* n (expt 4 n)))
Aziz,,,
