# Tag Info

26

Summary Important differences between Association and CreateDataStructure["HashTable"] include: associations are immutable whereas hash tables are mutable associations are hash array mapped tries as opposed to simple hash tables Mutability As a rule, Wolfram Language's native data structures are immutable. Any attempt to change even just a part ...

5

HashTable seems a bit slower in creating, probably due to compiling, than Association: n = 10^6; ht["Insert", # -> 2 #] & /@ Range[n]; // Timing (*{1.5625, Null}*) as = Association[ Table[i -> 2 i, {i, n}] ]; // Timing (*{0.96875, Null}*) For retrieving there is no big difference, HashTable is slightly faster: n = 10^6; ht["Lookup&...

5

Why is the result Missing["KeyAbsent", 2] + Derivative[1][z[2]][y] Heads are evaluated first. The head of Derivative[0, 0, 1][func][x, 2, y] is Derivative[0, 0, 1][func], which yields the following: Derivative[0, 0, 1][func] (* Missing["KeyAbsent", #2] + Derivative[1][z[#2]][#3] & *) This shouldn't be completely surprising ...

3

I suppose AssociationThread[Values@assoc, Keys@assoc], but it's not invertible if the values are not distinct. Also Association@KeyValueMap[#2 -> #1 &, assoc] with the same caveat.

1

TakeSmallest[data, 1] (* <|Entity["City", {"Athens", "Attiki", "Greece"}] -> 0.02|> *)

1

Thanks to the people who gave answers, but I thought I could be more succinct. There are 2 differences: immutability of <||>, which makes adding/deleting on an association a little slower. Immutability is not implemented in Mathematica as naively as copying the entire structure every time we add something to the association, but some extra work needs ...

Only top voted, non community-wiki answers of a minimum length are eligible