11

In Mathematica 9, I used to be able to do

rules = Dispatch[{'a' -> 1, 'b' -> 2}]
rules[[1]]

to extract the rules from Dispatchwrapped list of rules. In Mathematica 10 the following error is raised:

Part::partd: Part specification Dispatch[...][[1]] is longer than depth of object. >>

Is this a bug? I am using only the trial version currently. I got aware of it because it breaks the AutomaticUnits package.

phantomas1234
  • 627
  • 3
  • 11

1 Answers1

11

No, this is not a bug. Dispatch tables are now atomic:

Dispatch[{"a" -> 1, "b" -> 2, "c" -> 3}] // AtomQ
True

As noted by user 18w here we can use Normal to recover the rules.

Dispatch[{"a" -> 1, "b" -> 2, "c" -> 3}] // Normal
{"a" -> 1, "b" -> 2, "c" -> 3}
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371