📎 Webclip
F# |> I <3 | Pirrmann's train of thought
The post says F# has shaped the author’s everyday C# coding for years, and that a recent work project let him use F# for real. He also says the open-sourcing of Roslyn was welcome, but the bigger news for him was that Visual F# now accepts contributions, which makes him expect more from the language.
Reading notes#
- The author says he has been writing about F# for a while and has now gone “totally” over to F#.
- He presents a kata about values with uncertainty and operations that manipulate them.
- He models a value and its precision with a
Numbertype holding two floats. - He defines a
+-operator to build values like4.0 +- 1.0. - He uses FsUnit tests to check that a number equals itself and that addition combines values and accuracies.
- He writes a generic
combinefunction that evaluates an operator on the boundary values, then rebuilds the result from the minimum and maximum. - He adds operator overloading so
+,-,/, andPowall use the same combine logic. - He thanks @luketopia for the Twitter exchange and for the trick that lets
**be passed as an argument with spaces around the operator.
