Tag: F#

Type inference in F#

I have recently been to a short F# presentation at HiQ in Arboga. One of the things that got mentioned was type inference. Both Visual Basic and C# have type inference in their current version, but F# takes this one step further. This approach will produce two integers in VB when Option Infer is set […]

Read More

Tuples

Tuples in F# is a list of objects with different types, and the tuple itself is strongly typed. You can imagine a simple class or a structure without having to declare the type. This code creates a tuple called myTuple that contains a string, and integer, another string and finally a boolean. let myTuple=(“A”, 10, […]

Read More

F# functions

Functions are declared using the let keyword, followed by a name, a parameter list and a definition. This creates a function that adds to values and returns the result (first line). The two middle lines calls the function. let myFunction x y = x + y let result1 = myFunction 10 20 let result2 = […]

Read More

Using the framework from F#

Just by typing the open statement, you can use the .NET Framework, or any other referenced libraries. To access the Console type, just add the following line to your source code: open System This program uses the built-in library function printfn, and then the WriteLine function to write “Hello world” to the screen. printfn “Hello […]

Read More

F# and PhotoName

I have just decided to look in to F#, the new functional .NET language by Microsoft. It installs with Visual Studio 2010, and it can be installed for Visual Studio 9. I use Visual Studio 9 for my everyday work, so I installed it from here (click on the word MSI in the first paragraph […]

Read More