<br><br><div class="gmail_quote">On Mon, Nov 26, 2012 at 11:30 AM, Danny Yoo <span dir="ltr"><<a href="mailto:dyoo@hashcollision.org" target="_blank">dyoo@hashcollision.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br><div class="gmail_quote"><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I have a trivial task: read a null-terminated string from a stream.<br>
The size of the string has no predefined limit. How do I do that<br>
in Racket? I need some resizable thing to store characters,<br>
like vector<char> in C++ or StringBuilder in C# or Java.<br>
Does Racket have one?<br>
<br></blockquote></div></div></blockquote><div><br></div><div>Following up: more generally, you can find a variety of data structures in the 'data' collection. </div><div><br></div><div> <a href="http://docs.racket-lang.org/data/index.html">http://docs.racket-lang.org/data/index.html</a></div>
<div><br></div><div>and it includes growable vectors. For example:</div><div><br></div><div><br></div><div>;;;;;;;;;;;;;</div><div><div>> (require data/gvector)</div><div>> (define v (gvector))</div><div>> (gvector-add! v "hello")</div>
<div>> (gvector-add! v "again")</div><div>> v</div><div>#<gvector></div><div>> (for ([elt v]) (printf "I see ~s\n" elt))</div><div>I see "hello"</div><div>I see "again"</div>
</div><div><div>;;;;;;;;;;;;;</div><div></div></div><div><br></div></div>