# 10.0.2 mapping Association to Dataset warning

Bug introduced in 10.0.2 and fixed in 10.0.3

In 10.0.2

ExampleData[{"Dataset", "Titanic"}][All, <| "gender" -> #sex|> &]


Outputs the expected result, but also throws:

MapAt::partw: Part {1,All,2} of Association[gender->Atom[Enumeration[female,male]]] does not exist.

Whereas all is ok with:

ExampleData[{"Dataset", "Titanic"}][All, {"gender" -> #sex} &]

• I get the same. If you want to use Associations the following seems to work: ExampleData[{"Dataset", "Titanic"}][All, Association[{"gender" -> #sex}] &] – Sjoerd C. de Vries Dec 11 '14 at 21:44
• I get the same in V10.0.2 for MAC – Murta Dec 11 '14 at 22:34

This is a bug in the 10.0.2 version of the type inferencer, which now goes inside pure functions†.

It's 'harmless' in that the type inference will just give up and fall back on deduction (which is what it was going to do anyway).

I've fixed this for version 10.0.3, but in the meantime, here's a patch that will prevent the message:

Begin["TypeSystemInferencePackagePrivate"];
exprType[e_Association] := If[AssociationQ[Unevaluated[e]], Struct@MapUn[exprType, e], TypeSystemUnknownType];
End[];


You can safely put this in your init.m so it gets applied to all new kernels -- it won't slow anything down.

P.S. Perhaps we should have an 'errata' mechanism that allows us to apply micropatches like this via paclet download after a version has shipped. That would be nice.

† here is an example of type inference going into pure functions:

<< TypeSystem
t = Type[<|"x" -> Integer, "y" -> Real|>]
Function[#x + #y] ** t
Function[#x + #y + #z] ** t
`

Edit: thanks for finding and 'reporting'!