Skip to content

Latest commit

 

History

History
36 lines (27 loc) · 1.04 KB

README.textile

File metadata and controls

36 lines (27 loc) · 1.04 KB

An implementation of Hartmann pipelines in Erlang. In short, they are extensions of the usual Unix pipes that allow building graphs of programs and thus one can implement a full data-flow environment.

Read more in the wiki.

Examples

Code example with current API, counting the number of lines in a file containing “=” and the number of lines that don’t contain it:

    P1 = pipes:pipe(cat, [FileName]),
    P2 = pipes:pipe(lines),
    P4 = pipes:pipe(grep, ["="]),
    P3 = pipes:pipe(count),
    P5 = pipes:pipe(count),
    
    pipes:connect([P1, P2, P4, P3]),
    pipes:connect({P4, nomatch}, P5),
    
    {WithEquals, WithoutEquals} = {pipes:get_result(P3), pipes:get_result(P5)}.

This will look in the future similar to the Unix-ish

    {WithEquals, WithoutEquals} = pipes:build(
      " cat $FileName | 
        lines | 
        g: grep \"=\" |
        count > $1
      ",
      " :g/nomatch |
        count > $2
      "
    ).