
23 Feb
2006
23 Feb
'06
5:27 p.m.
On 2/23/06, Sebastian Sylvan
Sometimes you want to add an element, or update an existing element if one exists.
You may, for example, want to store a list of values at each node in a Map, so if a key doesn't exist you add a singleton list, if the key does exist you add the new value to the list with that key. The value type is thus of a *different* type than the values that are inserted.
insertWith' :: (b -> a -> a) -> (b -> a) -> k -> a -> c -> c
Sorry: insertWith' :: (b -> a -> a) -> (b -> a) -> k -> b -> c -> c /S -- Sebastian Sylvan +46(0)736-818655 UIN: 44640862