HN user

takle

18 karma

https://twitter.com/takle

Posts0
Comments6
View on HN
No posts found.

I agree with you. I'm going to write a post about function application and composition (right-to-left / left-to-right) so other communities can stop discussing non-essential matters.

I do like the fact that the `pipe operator` is often mentioned along the bash '|' which is used in a pointfree style.

Well it might make sense sometimes, so its good to know one's options :)

  p x y z = f (g x y) z
  p       = ((.) f) . g

One could also change the Haskell. Data.Function (&); Control.Arrow (>>>)

  -- the pipe operator seems to be all the rage these days
  (|>) = (&)
  
  -- forward application + forward composition
  xs |> (drop 3 >>> filter p >>> take 5)
Only function application
  xs |> drop 3 |> filter p |> take 5

# Why not ## Lodash `_.flow(b,c,d)(a)` // left to right `_.compose(d,c,b)(a)` // right to left `_.flowRight(d,c,b)(a)` // right to left `_.backflow(d,c,b)(a)` // right to left

## RamdaJS `_.pipe(b,c,d)(a)` // left to right

# But why are we inventing so many ways of doing forward, backward function application and composition.

Aside: I've never found an application of lodash `_.chain` that couldn't be expressed in a better way.

On the subject of testing, I think it's important that people don't follow testing methodologies blindly.

In the 1960s, Djikstra said "Testing shows the presence, not the absence of bugs", which is true.

Testing is a good tool to prevent regressions. A form of testing that I find quite interesting - and wish more people would look into - is property based testing. A good example of this can be found here http://fsharpforfunandprofit.com/pbt/. Scott Wlaschin is also quite good at teaching across coding paradigms, not just functional.