[racket] StringBuilder for Racket?

From: Danny Yoo (dyoo at hashcollision.org)
Date: Mon Nov 26 13:33:32 EST 2012

On Mon, Nov 26, 2012 at 11:30 AM, Danny Yoo <dyoo at hashcollision.org> wrote:

>
> I have a trivial task: read a null-terminated string from a stream.
>> The size of the string has no predefined limit. How do I do that
>> in Racket? I need some resizable thing to store characters,
>> like vector<char> in C++ or StringBuilder in C# or Java.
>> Does Racket have one?
>>
>>
Following up: more generally, you can find a variety of data structures in
the 'data' collection.

    http://docs.racket-lang.org/data/index.html

and it includes growable vectors.  For example:


;;;;;;;;;;;;;
> (require data/gvector)
> (define v (gvector))
> (gvector-add! v "hello")
> (gvector-add! v "again")
> v
#<gvector>
> (for ([elt v]) (printf "I see ~s\n" elt))
I see "hello"
I see "again"
;;;;;;;;;;;;;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20121126/c1ce3eec/attachment.html>

Posted on the users mailing list.