6 people like it.

Improved map declaration

Ruby like map declaration syntax

1: 
2: 
let (=>) x y = x,y
let z = Map ["hello" => 1; "bye" => 2]
val x : 'a
val y : 'b
val z : Map<string,int>

Full name: Script.z
Multiple items
module Map

from Microsoft.FSharp.Collections

--------------------
type Map<'Key,'Value (requires comparison)> =
  interface IEnumerable
  interface IComparable
  interface IEnumerable<KeyValuePair<'Key,'Value>>
  interface ICollection<KeyValuePair<'Key,'Value>>
  interface IDictionary<'Key,'Value>
  new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
  member Add : key:'Key * value:'Value -> Map<'Key,'Value>
  member ContainsKey : key:'Key -> bool
  override Equals : obj -> bool
  member Remove : key:'Key -> Map<'Key,'Value>
  ...

Full name: Microsoft.FSharp.Collections.Map<_,_>

--------------------
new : elements:seq<'Key * 'Value> -> Map<'Key,'Value>
Raw view New version

More information

Link:http://fssnip.net/61
Posted:8 years ago
Author:Saagar Ahluwalia
Tags: data structures , syntax