What`s wrong with this declaration?

1
let foo = Map [1, 1; 2, 4]
By on 2/19/2010 8:31 AM ()

First of all that won't work you have to write:

let foo = Map<_,_> [1, 1; 2, 2]

Also writing it the way i showed is better because you map keys explicitly to values instead just putting a tuple which can be confusing.

By on 2/19/2010 1:15 PM ()

Great! I like it. I also find it more readable (but I don't see the need for your map function):

1
let foo = Map [0, 1; 1, 2; 2, 4; 3, 8; 4, 16]

VS

1
2
3
4
5
6
7
8
 

let pot = Map [ 0 => 1
                1 => 2
                2 => 4
                3 => 8
                4 => 16 ]

Notice that you can omit the semicolons in the second form. Plus, I find it more consistent with how Visual Studio displays it:

By on 2/20/2010 2:44 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper