Why don't I see pipe operators in most high-level languages? -


Unix shell is an extremely powerful tool in programming. With a small set of core utilities, a system language (such as C) and scripting language (such as Python) can create very compact and powerful shell scripts, which are automatically parallel to the operating system.

Obviously this is a very powerful programming paradigm, but I have not seen the pipe as a first class separation in any language other than a shell script. To repeat the functionality of the script using Pipes, the code necessary is always necessary.

So my question is that I have some modern high level languages ​​like Unix pipes like C #, Java, etc.? Are there languages ​​(except Shell Script) that support the first class pipe? Is not it a convenient and secure way to express concurrent algorithms?

When someone brings it, I look at the F # pipe-forward operator (forward pipe operator), and this function looks like the application operator. It states that, as far as I can tell, one function is applied in the data instead of adding two currents together, but I am open for improvement.

PostScript : While doing some research on implementing Coroutines, I know that there are some similarities. A similar problem has been described to me in Martin Wolf, but in the context of coroutines instead of pipes

You can parallel pipeline type very easily in Erlang. Below is a shameless copy of my blog post / Paste January 2008.

In addition, parallel functions allow structure, which is equivalent to the same thing, giving you an equal affinity.

You already think of pipelines - how about "gzcat foo.tar.gz | tar xf -"? You do not know it, but Shell is unzip and running in parallel - Stdin is read in tar until data is sent through gzcat to stdout.

Okay, many tasks can be expressed in the case of pipelines, and if you can do this, then the assistant code of David King (even in the Erlang nodes, ie machines) With some parallel levels it is easy to get:

  pipeline: run ([pipeline: generator (bigist), {filter, funny_filter1}, {map, fun_some_map / {Generic, funny some_complex_function}, fun some_more_complicated_function / 1, fun pipeline: Ekat / 1]).  

So basically he is making a list of steps he is doing here - each stage is implemented in a fun manner which accepts as input that the previous step Output (fun can also be defined inline, of course). Check out the code for more detailed explanation.


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -