Hello 2015-03-13 20:18 GMT+01:00 <[email protected]>:
> I hope this is the place to ask about JOOL. Appologies if not. > Yes, it's OK. Otherwise, a GitHub feature request might work as well: https://github.com/jOOQ/jOOL/issues/new > I need to be able to combine multiple streams in a combinatorial manner. > e.g. I have n streams (n would normally be 2 or 3) and I want to generate > a single stream that contains every combination of elements in each of > those streams. > Looking at JOOL it seems that Seq.duplicate() and Seq.intersperse() may be > useful in handling this, but I'm not sure how to go about this. > Essentially I'm looking for something that looks a bit like this: > > Stream<Tuple> combine(Stream... streams) > > Just to be clear, if I had 2 streams, A and B that had these values: > > A: X,Y,Z > B: 6,7,8 > > I would get a single stream that contains: > > (X,6), (X,7), (X,8), (Y,6), (Y,7), (Y,8), (Z,6), (Z,7), (Z,8) > > Note: the streams do not need to be the same size, you just get A * B (or > A *B * C ...) elements in the resulting stream. > Hmm, that would be a cartesian product or cross product of A x B: http://en.wikipedia.org/wiki/Cartesian_product I'm sure you know what you're doing. As a SQL guy talking to DBA all the time, this is kind of a poisonous topic ;-) Right now, jOOL doesn't help you do that, but there is a lot of talk about the topic when in combination with Scala. E.g.: http://stackoverflow.com/q/8217764/521799 We'd happily merge a contribution if you want to give an implementation a shot... Cheers Lukas -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
