User defined pipe and redirection operators: Difference between revisions

m
reduce task description...
(→‎Tcl: Added implementation)
m (reduce task description...)
Line 1:
{{wikipedia|Pipeline_(Unix)}}{{Draft task|Define pipe and redirection operators}}
<!--
{{wikipedia|Pipeline_(Unix)}}
In [[wp:Unix-like|Unix-like]] computer [[wp:operating system|operating system]]s (and, to some extent, [[wp:Microsoft Windows|Microsoft Windows]]), a '''pipeline''' is the original ''[[wp:pipeline (software)|software pipeline]]'': a set of [[wp:process (computing)|process]]es chained by their [[wp:standard streams|standard streams]], so that the output of each process (''[[wp:stdout|stdout]]'') feeds directly as input (''[[wp:stdin|stdin]]'') to the next one. Each connection is implemented by an [[wp:anonymous pipe|anonymous pipe]]. [[wp:Filter (Unix)|Filter program]]s are often used in this configuration.
 
Line 6 ⟶ 8:
Unix pipeline can be thought of as [[wp:left associative|left associative]] [[wp:Infix notation|infix operation]] whose operands are programs with parameters. Programatically all programs in pipeline run at the same time (in parallel), but, looking at syntax, it can be thought that one runs after another (note, that parallelism is actually emulated; for how just see how pipelines are implemented later on this page). It is a [[wp:functional composition|functional composition]]. One can be reminded of [[wp:functional programming|functional programming]], where data is passed from one function to another (as their input or output).
 
'''Task:'''-->
If the language supports operator definition, then:
* create "user defined" the equivalents of the Unix shell "<", "|", ">", "<<", ">>" and $(cmd) operators.
* Provide simple equivalents of: cat, tee, grep, & uniq, <!-- wc, head & tail, --> but as filters/procedures native to the specific language.
* Replicate the below sample shell script, but in the specific language
* Specifically ''do not'' cache the entire stream before the subsequent filter/procedure starts. Pass each record on as soon as available through each of the filters/procedures in the chain.