[rust-dev] Iterators, lists, vectors

Rust rust at kudling.de
Thu Jan 12 07:30:32 PST 2012

i wonder how we will "replicate" Haskell's lazy lists.
For example: `str::split` splits a string and returns a list/vector of
But maybe we don't want to duplicate those sub-strings in memory and we don't
want to create such an intermediate list/vector
if we just plan to iterate over it. 
We could add a `str::split_iter` which calls a block instead.
But then we'd need to duplicate every function: one returning a list/vector, and
the other taking a block.
=> interface explosion 
Am i missing something (e.g. that strings are immutable and the list of strings
are just "pointers" to the orignal string)?
Do we need lazy sequences?
Any other idea?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/rust-dev/attachments/20120112/337cbec0/attachment.html>

More information about the Rust-dev mailing list