Niner since 2009
I t was very interesting. I was wondering if anyone knows the reason behind a specifict F# design decision.
About the pipe operator: |> Why is a |> b c interpreted as a |> (b c) instead of (a |> b) c ? Isn't left to right most logical?
A more specific example:
let multiply a b = a * b;;
let substract a b = a - b;;
multiply 2 3 |> substract 10;; returns 4
so it is interpreted as: multiply 2 3 |> (substract 10);; while it seems logical to interpret this as: (multiply 2 3 |> substract) 10;;
----
furthermore, in response to the question from your audience, about inserting the middle parameter, you could have answerd: let answer a b c = a / b - c;;
if you want to insert the middle parameter b,
(multiply 2 3 |> answer 30) 4;;
will yield the desired result...
Here is a list of Channel 9 staff members.
Taking Efficiency One Step Further - F#
Sep 11, 2009 at 7:59 AMI t was very interesting. I was wondering if anyone knows the reason behind a specifict F# design decision.
About the pipe operator: |>
Why is a |> b c interpreted as a |> (b c) instead of (a |> b) c ? Isn't left to right most logical?
A more specific example:
let multiply a b = a * b;;
let substract a b = a - b;;
multiply 2 3 |> substract 10;;
returns 4
so it is interpreted as:
multiply 2 3 |> (substract 10);;
while it seems logical to interpret this as:
(multiply 2 3 |> substract) 10;;
----
furthermore, in response to the question from your audience, about inserting the middle parameter, you could have answerd:
let answer a b c = a / b - c;;
if you want to insert the middle parameter b,
(multiply 2 3 |> answer 30) 4;;
will yield the desired result...