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. Assuming dimension 2 I performed some optimizations. I have written syntax-case macro code that should construct this
function for arbitrary dimension, except I cannot get it to work.

Before getting into the macro business, can you show how this
function would look for arbitrary number of dimensions?  Like,
can you complete the following

(define (walk-f-general depth dims)
  ---)

such that
  (walk-f depth)
above would compute the same value as
  (walk-f-general depth 2)

Aziz,,,

Reply via email to