ccarter
(W. Craig Carter)
1
I find I am using AssociationMap more and more.
It would be nice to have an equivalent to Map’s /@ key-sequence.
For example, suppose <@ could be the sequence for AssociationMap, then we would have:
Sin[Pi/#]&<@Range[10]
would give:
<|1 -> 0, 2 -> 1, 3 -> Sqrt[3]/2, 4 -> 1/Sqrt[2]|>
Although, perhaps this creates unreadable code for distribution.
2 Likes
Vitaliyk
(Vitaliy Kaurov)
2
Some functions recently were upgraded to an operator form. That is mentioned in the ref page - see 3rd line:
?AssociationMap

This basically means:
AssociationMap[f]@{a, b, c, d}

So in your case
AssociationMap[Sin[Pi/#] &]@Range[4]

Not exactly what you need, - I just noting perhaps useful thing.
1 Like