4 ms·
namespace Org.DictionaryExtensions = type Dictionary<'T> with member x.get(key,defaultValue) = match x.TryGetValue(key) with | (true,val
by fleitz 16y 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.
- Gonsalu 16y agoI 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.