The documentation for associations says that the keys of an association are transparent for many operations. Map
is one such operation. However, I am confronted with something a bit unexpected.
Clear[a, f];
a = <|1 -> <|2 -> {{6, 8}, {6, 10}}|>, 6 -> <|8 -> {{14, 18}, {2, 4}}|>|>;
f = Select[#[[2]] >= 10 &] @ # &;
f /@ a (* <|1 -> <| |>, 6 -> <| |>|> *)
f @ {{6, 8}, {6, 10}} (* {{6, 10}} *)
f @ {{14, 18}, {2, 4}} (* {{14, 18}} *)
I don't understand why f
applied individually to the arguments produces the desired result, but when mapped over those same arguments inside the association, does not. What is the error in my thinking?
Thank you in advance for your help.