The problem is that a String allocates a buffer and so has to fill it
eagerly.

You could implement
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/CharSequence.html.

I don't know wether Seqs implements that. Else, you could use deftype to do
it yourself, but it will be hard.

If you just want to a something with the string, as printing it, then the
best it too write it as a dorun of a smaller function.
dorun do not retain the full structure in memory.

Ex : to print something
---pseudocode, I am to lazy to test

(dorun function-that-print-a-char lazy-seq-of-char)

That would be the most idiomatic and simple, if you don't need to interface
your String with Java.




On Tue, Jun 29, 2010 at 4:26 PM, Paul Moore <p.f.mo...@gmail.com> wrote:

>
> So you're looking for a result that behaves like a string, but isn't
> an actual java.lang.String, rather it's a type that produces
> characters lazily, "on demand" somehow?
>
> I'm afraid I've no idea if Clojure has such a thing, or even if it
> could support such a thing. (There's no "string abstraction" similar
> to the "seq abstraction", as far as I'm aware). But I'm very new at
> Clojure, so I could easily be wrong...
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to