

Functional programming, APL and Unix pipes (2007) - brudgers
http://porg.es/blog/functional-programming-apl-and-unix-pipes

======
dwb
Note this operator now exists in the latest base package as

    
    
      x & f = f x
    

[http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-
Fu...](http://hackage.haskell.org/package/base-4.8.0.0/docs/Data-
Function.html#v:-38-)

------
akkartik
My toy lisp interpreter from a couple of years ago had a pretty neat (in all
modesty) implementation of infix operations that permitted Clojure's threading
macro[1] to be infix:
[http://akkartik.name/post/wart](http://akkartik.name/post/wart)

[1] OP is really about the threading macro rather than unix pipes, since the
latter also does concurrency and flow-control really well.

~~~
wging
Re: your [1], Clojure's threading macros came to mind first for me as well.

    
    
        (->> 
          [(range 20 31) (range 490 501) (range 8120 8131)]
          (apply concat)
          (map classify)
          (reduce getCounts [0 0 0]))
    

Expands as follows:

    
    
        user> (macroexpand
               '(->> 
                 [(range 20 31) (range 490 501) (range 8120 8131)]
                 (apply concat)
                 (map classify)
                 (reduce getCounts [0 0 0])))
        (reduce
         getCounts
         [0 0 0]
         (map classify (apply concat [(range 20 31) (range 490 501) (range 8120 8131)])))
    

Now that you mention concurrency and flow-control in the context of these
macros, it seems a little weird to me that we have "threading macros" that
really are about weaving expressions together rather than
concurrency/threading.

------
RodgerTheGreat
Related, Concatenative programming:

[http://concatenative.org/wiki/view/Pipeline%20style](http://concatenative.org/wiki/view/Pipeline%20style)

------
ubertaco
Someone mentions in the comments on this blog post F#'s |> operator, which
I've found nice both in F# and in its cousin/ancestor OCaml.

