Hi John,<br><br><div class="gmail_quote">2013/5/7 John Gateley <span dir="ltr"><<a href="mailto:racket@jfoo.org" target="_blank">racket@jfoo.org</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Here's a summary of the responses. Thanks to everyone who<br>
replied. My comments are in [ and ]. Not much new though.<div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
5) Is there an implementation of vectors that can change in size?<br>
Like C++'s std::vector?<br>
</blockquote>
<br>
<br>
</div><a href="http://docs.racket-lang.org/data/gvector.html" target="_blank">http://docs.racket-lang.org/<u></u>data/gvector.html</a><br>
<br>
[This is close, but I don't see an operation to explicitly grow the<br>
vector, other than adding one element at the end. For some algorithms,<br>
you want to grow the vector exponentially - doubling the size instead<br>
of adding one element.]</blockquote><div><br></div><div>That is exactly what happens behind the scenes.</div><div><br></div><div>A gvector is implemented as a structure containing a vector v</div><div>and a number n. The vector holds the elements in the gvector and</div>
<div>n represents the number of elements used in the vector n.</div><div>Each time the vector v is filled, a new vector of the double size</div><div>is allocated and the elements are copied into the new vector.</div><div>
<br></div><div>The exact details can be studied here:</div><div><a href="https://github.com/plt/racket/blob/master/collects/data/gvector.rkt">https://github.com/plt/racket/blob/master/collects/data/gvector.rkt</a></div><div>
<br></div><div>-- </div><div>Jens Axel Søgaard</div><div><br></div></div>