matz / streem

prototype of stream based programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Will there be a way to specify more than one consumer of a flow?

collins-williams opened this issue · comments

Usually several instances of the same processing running to take advantage of whatever paralellism is available.

Yes,

STDIN | stream1
STDIN | stream2

both streams will receive same input from STDIN.

What about STDIN >stream1 >stream2 ?
On Dec 18, 2014 9:58 PM, "matz" notifications@github.com wrote:

Yes,

STDIN | stream1
STDIN | stream2

both streams will receive same input from STDIN.


Reply to this email directly or view it on GitHub
#41 (comment).

So,

STDIN | stream1
stream1 | stream2
stream1 | stream3

stream2 and stream3 will receive the same input of stream1? This is intuitive.

how about introducing the tee combinator?

stream1 = { |x|
  ...
}

stream2 = { |x|
  ...
}

STDIN | tee [stream1, stream2, ...]

I like the tee combinator

@shuichiro-makigaki Yes.

@shouya I will think about tee combinator, as well as roundrobin.

How can streem1>streem3 and streem2>streem4 when we use STDIN | tee [stream1, stream2, ...] ? we may need another way.

How about tee [stream1, stream2] > tee [stream3, stream4] ?

I like the original suggestion by @matz:

STDIN | stream1
STDIN | stream2

It seems far more intuitive, which is what we want, considering that this will be a fairly common operation. I mean, if I were using the language with no prior knowledge of it, the above code would be the first thing I try. That kind of ease-of-use and intuitiveness just might be something we want to aim for.

Considering this will be a very common operation, it should also be
possible to express it much more tersely. (What is more intuitive to you
now will quickly become tiresome if used hundreds of times.)

Why not support all the options expressed here?
On Dec 19, 2014 2:44 PM, "Christopher Dumas" notifications@github.com
wrote:

I like the original suggestion by @matz https://github.com/matz:

STDIN | stream1
STDIN | stream2

It seems far more intuitive, which is what we want, considering that
this will be a fairly common operation. I mean, if I were using the
language with no prior knowledge of it, the above code would be the first
thing I try. That kind of ease-of-use and intuitiveness just might be
something we want to aim for.


Reply to this email directly or view it on GitHub
#41 (comment).

It's not hard to add operations like tee afterward, e.g.

STDIN | tee(stream1, stream2)