News for hackers. Stuff that matters.
Re:Why did Microsoft invest so much in F#? by masklinn on Monday November 08, 2010 @05:42PM (#1884358)
> let value = match dict.TryGetValue("foo") with > | (true,val) -> val > | (false,_) -> "default"

groan

    let value = findWithDefault "default" "foo" dict
or

    case M.lookup key dict of
         Just v -> v
         Nothing -> "default"
(and for anybody who wants to whine about parameters order, please remember — or discover — that partial application is extremely frequent in Haskell and MLs, and try to read the parameters order in this light, you will be enlightened)
Re:Why did Microsoft invest so much in F#? by timrobinson on Monday November 08, 2010 @06:24PM (#1884494)
dict.TryGetValue is an odd example here -- idiomatic F# for a map lookup would be:

    let value = defaultArg (Map.tryFind "foo" dict) "default"
or

    match Map.tryFind "foo" dict with
    | Some v -> v
    | None -> "default"
Re:Why did Microsoft invest so much in F#? by masklinn on Tuesday November 09, 2010 @01:56AM (#1885648)
> dict.TryGetValue is an odd example here

I sure as hell hope so, but that's what fleitz used.