Thanks to a somewhat misapplied use of MapThread I learned of this behavior:
<|a -> 1, b -> 2|> + <|a -> 5, b -> 6|>
<|a -> 6, b -> 8|>
Furthermore this applies to all Listable functions:
SetAttributes[foo, Listable]
foo[<|a -> 1, b -> 2|>, <|a -> 5, b -> 6|>]
foo[<|a -> 1, b -> 2|>, bar]
foo[<|a -> 1, b -> 2|>]
<|a -> foo[1, 5], b -> foo[2, 6]|>
<|a -> foo[1, bar], b -> foo[2, bar]|>
<|a -> foo[1], b -> foo[2]|>
I do not recall seeing this is the documentation for Association. Is this documented behavior?
Comments
Post a Comment