Skip to content

vladdu/erl-pipes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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
      "
    ).

About

Hartmann pipes in Erlang

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages