is something like this an acceptable approach? (just teat a linear array like a 2d array). seems like a better version of this stuff is probably part of the included stuff, I would imagine. Like there's probably a way to get the size of a vector. I was going to make a (array-2d-print) function, too that displays it like a grid ..... maybe tomorrow. Any suggested improvements or directions are of course welcome.<br>
<br>(define (make-array-2d size initial)<br> (make-vector (* size size) initial)) <br><br>(define (array-2d-ref array size row col)<br> (vector-ref array (+ (* row size) col)))<br><br>(define (array-2d-set! array size row col value)<br>
(vector-set! array (+ (* row size) col)))<br><br>> (define deposits (make-array-2d 17 0))<br><br>> (array-2d-ref deposits 17 0 11)<br>0<br><br>> (array-2d-set! deposits 17 0 11 39)<br><br>> (array-2d-ref deposits 17 0 11)<br>
39<br><br><br><br><div class="gmail_quote">On Sat, Feb 14, 2009 at 4:40 PM, Chongkai Zhu <span dir="ltr"><<a href="mailto:czhu@cs.utah.edu">czhu@cs.utah.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
and every slot of the vector is filled with `fill'. In your</blockquote></div><br>