# Association of pure functions [duplicate]

I've encountered confusing behavior of Association when I try to use it for storing pure functions.

For example:

as = <|"1" -> # + 1 &|>


Association["1" -> #1 + 1 &]

Strangely:

AssociationQ@as


False

and it is not possible to extract the value by the key:

as["1"]


Association["1" -> #1 + 1 &]["1"]

Is this the intended behavior?

P.S. Wrapping pure functions in Hold[] solves the problem, but I'm still curious why doesn't Association work without it.

• I have closed this as a duplicate as the origin of the unexpected behavior is the same: the grouping of the & operator. Please also see: (30425) – Mr.Wizard Oct 7 '14 at 20:00

as = <|"1" -> (# + 1 &)|>

Rule (->) has lower precedence then &.