Bug introduced in 10.0.0 and fixed in 10.1 or earlier
The Documentation Center item, Computation with Structured Datasets, implies that Append
has been extended in V10 to work with datasets. But not on my computer. (I am running on OS X)
Here is what I tried:
ds =
Dataset[{<|"a" -> 1, "b" -> "x"|>, <|"a" -> 2, "b" -> "y"|>,
<|"a" -> 3, "b" -> "z"|>, <|"a" -> 4, "b" -> "x"|>}]
Append[ds, <|"a" -> 5, "b" -> y|>]
However, insertion
Insert[ds, <|"a" -> 5, "b" -> y|>, -1]
works fine.
I don't know whether I've found a bug in Append
in combination with a dataset or whether I am misreading the documentation. Are others experiencing what I am? Or can someone explain what I did wrong?
Update
I should have pointed out that I already knew that appending Append[ds, <|"a" -> 5, "b" -> "y"|>]
worked. But why does it fail when given an unbound symbol? And why should Insert
behave differently when given an unbound symbol? Is V10 attempting to enforce some kind of a type consistency on the values of associations? That would be very un-Mathematica like.
AppendTo[ds, <|"a" -> 5, "b" -> y|>]
works fine $\endgroup$