is this code right way to do it?<div><div>#lang racket</div><div>(define v (build-vector 2 (λ (n) </div><div> (build-vector 2 (λ (n) </div><div> (vector "1" "2" "3"))))))</div>
<div> </div><div> (vector-set! (vector-ref (vector-ref v 0) 0) 0 "2")</div><div> v</div><br><div class="gmail_quote">On 20 November 2010 17:31, 김태윤 <span dir="ltr"><<a href="mailto:kty1104@gmail.com">kty1104@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">thank you !<div>could you tell me how to make new vector that does not refer to a single vector?</div><div><div></div>
<div class="h5"><div><br><br><div class="gmail_quote">On 20 November 2010 17:09, Neil Van Dyke <span dir="ltr"><<a href="mailto:neil@neilvandyke.org" target="_blank">neil@neilvandyke.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">"make-vector" is creating a new vector populated with *references* to a single #("1" "2" "3") vector, *not* *copies* of the #("1" "2" "3") vector.<br>
<br>
Since you've created one #("1" "2" "3") vector, changing it through one reference changes all references to it.<br>
<br>
(Aside to PLT people: This might be an example of having the default writer show sharing could actually be helpful to beginners.)<br><font color="#888888">
<br>
-- <br>
<a href="http://www.neilvandyke.org/" target="_blank">http://www.neilvandyke.org/</a><br>
</font></blockquote></div><br></div>
</div></div></blockquote></div><br></div>