Skip to content

Tag Archives: f#

Matching patterns in F#

Patterns in F# are kind of like switch statements in C#, but much more powerful. For my first experiment with them I decided to see if I could find a word in a sentence. This is definitely the wrong way to go about solving this problem, calling String.Contains() would be easier. But I am still [...]

Initialization In F and C #

There are some common compiler tricks in F# and C#, for example object initialization.

In C# 3.0 we have Object Initializers which allow for an object to be instantiated via an explicit constructor call and properties to be set in one statement.

Form f = new Form1() { Text = “Hello” }; Application.Run(f);

And in F# we [...]

Inferred Generics in F#

The first hundred or so pages of Expert F# have been really interesting, the compiler feels so much more advanced than C#. Although I think it has more to do with the nature of functional programming than any deficiency in the C# compiler. The code does not tell the machine how to do something rather [...]