Hacker News new | ask | show | jobs
by fleitz 5702 days ago

  namespace Org.DictionaryExtensions =
    type Dictionary<'T> with
     member x.get(key,defaultValue) = 
       match x.TryGetValue(key) with
       | (true,val) -> val
       | (false,_) -> defaultValue
There fixed that for you, now you can do, dict.get("foo","defaultvalue") in whatever CLR language you like. :)

As for fast and knocking .NET you're not seriously suggesting python are you? Runtime method lookup is not exactly what I think when thinking fast.

1 comments

I wasn't knocking .NET; I had the idea that coding something in C# or F# would result in the same IL output, which, after reading MichaelGG's reply, I realized was completely wrong...

Regarding Python speed, I know it's pretty slow, especially the IronPython implementation.