-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Streem examples #46
Comments
Keep in mind that Streem is in its really early phase of development. As far as I'm aware, not much is implemented yet besides parsing source files. There's still a bit of design discussion going on. That being said, Streem already has a few pretty cool conceptual ideas, like functional programming concepts and sending one stream to multiple consumers. |
Heres an idea though:
|
If it's premature to add a real-world example, what else? |
Hello World
|
Fibonacci
This is a fairly naive example in terms of performance, but it should work (hopefully). Edit: Whoops, this seems to be broken with the current streem parser. Any ideas as to what's wrong? |
Currently, I think you can't write |
Is it
and how do you give functions names. More examples, please.
|
@blkdev Those should both work, Streem should have first class functions. |
I added some examples in 2dce6a4. More to come. |
@matz They are great examples. Until now, I didn't think of Streem as a language that could do TCP connections. 😎 |
@matz Cool! Out of curiousity, does |
@nicolasmccurdy it should be a list. I'd like to reserve |
So is |
Maybe we could use '>>' for pipes, and '%' for splitting them. |
This example "05chat.strm" makes me confused:
I'm not sure "broadcast | s" means data came from "s" to "broadcast" or came from "broadcast" to "s". |
@Krysl |
@nicolasmccurdy I might confused you. I meant I wanted to reserve |
Another alternative is using the pipeline operator found in F# that being
Or your could pipe it backwards too. I think this looks kinda confusing though:
Though I think as more on an architectural side note, I think this example could be confusing at first glance since its not explicitly clear how the
I think its important to explicitly distinguish that we would rather always run pipelines in an asynchronous manner since it would lend to a concurrent design and you would not have to worry about a pipeline blocking another one especially if ran in an event loop or thread pool. For example, the order of which the numbers in this example would get printed out is nondeterministic since both pipelines would be running concurrently (unless we added like a join or something between them before sending it to
Of course, individual pipes in a single pipeline would always run in a blocking fashion since you have to wait for input to work with (ex: in I think these are important concepts to think about going down the road either way. |
👍 for |
Please see #18 (comment) |
See #18 comment for FizzBuzz in F# too for example. |
How about named pipe?
And make it more simple, may like this
And if a function can be bind to the named pipe, like a filter. 05chat.strm may look like this:
[FIFO] may looks strange, we may need better symbols. |
@ChristopherDumas Agreed. That seems very clear to me, and it also looks kinda nice. |
|
What would be nice is if there would be "cookbook examples" for streem too. Like we have fizzbuzz but what about other popular redirections? File stuff; also perhaps binary ... video, audio ... these things. One could also do this via named pipes I suppose; just assign special functions to these pipes to act as filters (a bit similar how gstreamer handles source/sinks). But matz also said that streem is experimental and it probably has lower priority than e. g. mruby so I guess this is stuff that may all happen "at a later time". :) |
fibonaccidef fib (n) { seq(10) | fib | stdout
fibonaccidef fib (n) { seq(10) | fib | stdout if add () is ok for now. |
So far, it seems that the only thing anybody knows how to write with Streem is the FizzBuzz and cat programs. Obviously, a language can't be that useful if it can only do FizzBuzz and cat.
Please comment on this issue with your examples of more useful things you can do with Streem. I still need to be convinced that there are any.
The text was updated successfully, but these errors were encountered: