Stream generators (original) (raw)
Joe Bowbeer joe.bowbeer at gmail.com
Fri Nov 30 09:41:34 PST 2012
- Previous message: Stream generators
- Next message: Stream generators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
My first impression is that there are a lot. Whether they carry their weight depends on how difficult it is to implement these directly.
I think it would be beneficial for comparison to show a bit of their implementations.
repeat(n) in Scheme is about 10 characters.
How difficult is it to implement a merge, as might be needed to generate Hamming numbers? (One of my favorite test cases.)
Is there a method to limit a stream to a length? If so then one of your methods may be extra baggage.
Joe On Nov 30, 2012 9:21 AM, "Brian Goetz" <brian.goetz at oracle.com> wrote:
We've got a few generators for infinite streams already implemented. For object streams:
// produces seed, f(seed), f(f(seed)), ... iterate(T seed, UnaryOperator f) // infinite constant sequence repeat(T t) // finite constant sequence repeat(int n, T t) // infinite sequence driven by a supplier function repeatedly(Supplier f) // finite sequence driven by a supplier function repeatedly(int n, Supplier f) // infinitely cycle through an Iterable cycle(Iterable iterable) For integer streams, the above, plus range(int from, int to) range(int from, int to, int step)
Ignoring naming for the time being: - Do these carry their weight? - Are we missing any? - What related functionality are we missing that might undermine the utility of these (e.g., zip)?
- Previous message: Stream generators
- Next message: Stream generators
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the lambda-libs-spec-observers mailing list