[Haskell-cafe] Syntax proposal for "reverse apply"/"pipeline apply" (flip ($))
Richard A. O'Keefe
ok at cs.otago.ac.nz
Thu Apr 24 00:29:16 UTC 2014
On 18/04/2014, at 1:11 AM, Alexey Muranov wrote:
> I do not know F#, and maybe i am missing something, but assuming that
>
> x |> f |> g == (x |> f) |> g
>
> and
>
> g <| f <| x == g <| (f <| x)
>
> what are
>
> x |> f <| y
>
This is the same as (f x) y. Determined by experiment:
let h x y = (x,y) ;;
1 |> h <| 2 ;;
=> val it : int * int = (1, 2)
(f y) x would give the answer (2, 1).
>
> g <| x |> f
This is f (g x). Determined by experiment:
let f x = x * 2 ;;
let g x = x + 1 ;;
g <| 1 |> f ;;
=> val it : int = 4
g (f 1) would give the answer 3.
More information about the Haskell-Cafe
mailing list