So I have the following code:
// Learn more about F# at http://fsharp.net
open System
open System.Linq
open Microsoft.
Well one thing that you will probably run into eventually is problems with type inference. Look at this example for instance:
open System
open System.Linq
open Microsoft.FSharp.Collections
let a = ["a", 2; "b", 1; "a", 42; ]
let c = a |> Seq.groupBy (fst) |> Seq.map (fun (x,y) -> x, Seq.length y)
//Type inference will not work here
//let d1 = a.GroupBy(fun x -> fst x).Select(fun x -> x.Key, x.Count())
//So we need this instead
let d2 = a.GroupBy(fun x -> fst x).Select(fun (x : IGrouping) -> x.Key, x.Count())
for i in c do
Console.WriteLine(i)
for i in d2 do
Console.WriteLine(i)