Questions on the associative data-structure introduced in Mathematica version 10.

learn more… | top users | synonyms

3
votes
1answer
58 views

Given a list made up of subsets of an alphabet, how can I use associations to create a Boolean dictionary of the given list

I have a list of 30,000 elements, each of the element is a list in itself {{a, b}, {p, q, r}, {a, p}, ..., {z, x}}. Second one contains unique elements ...
7
votes
1answer
69 views

Assigning new value in association

I experienced a problem in changing values in an association and broke down the problem to the following: Given a list of association (here with one element): ...
2
votes
2answers
92 views

KeyMap on a flat Dataset (i.e. Dataset@Association)

How can I go from Dataset[<|"A" -> 1, "B" -> 2, "C" -> 3|>] to ...
3
votes
1answer
55 views

Converting path list to the nested list

I'm trying to convert the plain path list to the nested tree list like the following codes. ...
0
votes
0answers
37 views

Strange behavior of AssociationMap

here is what I've searched over stackexchange I'm on windows 8.1 x64 with Mathema... 10.0.2. sometimes, Definition[AssociationMap ]=Null I found ...
6
votes
1answer
75 views

Select From List of Nested Associations

I have an association: ...
5
votes
4answers
130 views

Functional way to Climb an Association Decision Tree

Associations are nice tool to create decision trees. Here is a toy example of how I'm starting to use it: ...
3
votes
1answer
48 views

Transform a table (list of associations) to a flat association

I would like to transform a table like ...
5
votes
1answer
94 views

Select query with named slot lookups?

Given this Dataset fragment (copy-paste friendly version at bottom) Can this query be simplified by referencing named slots directly in the ...
1
vote
0answers
56 views

Speed up replacement using Rule Dispatch Associtation

I knew that this has asked many times, but I hope there is something more could be done to speed this up. The expression kappa is here. ...
4
votes
1answer
46 views

How to make Association reflect new assignments

How do I get Association to act like List in the following? ...
2
votes
2answers
70 views

Using ListPlot and lists of Associations

I have a list of associations : ...
6
votes
1answer
163 views

10.0.2 breaks a recursive “trie” query

10.0.2 Dataset type system complication breaks a recursive trie constructor that worked in 0.1: ...
1
vote
2answers
58 views

Association without an associated value

Sometimes, we only need to store the keys which will be checked whether certain keys exist in the data structure(corresponding data structures in C++ are std::set ...
4
votes
0answers
60 views

Bug in ExportString with Associations as ExpressionML?

If I try to export this toy code as ExpressionML or just XML: ...
7
votes
2answers
242 views

10.0.2 another Dataset type system (inference?) warning

Bug introduced in 10.0.2 The warning below seems unrelated to these issues: Did 10.0.2 break some forms for named slots? and 10.0.2 mapping Association to Dataset warning. First noticed w/ ...
13
votes
2answers
246 views

Difference between Association and Dispatch

In the example below, Association has a different behavior from Dispatch: ...
3
votes
3answers
103 views

ReplacePart equivalent for Associations

I have a fairly complicated Association. I wish to use/create a function such as ReplacePart to operate on certain Keys within this multi-level Association. Here's ...
4
votes
1answer
59 views

Filtering Query Nested Data (Dataset and Association)

I am trying to filter a nested Dataset. I have some data that looks like this (curated for this example): ...
0
votes
0answers
29 views

Parallel assigning to an Association

This is a simplified example of a problem I ran into. I want to count how often a subkernel executes a given computation. So, after having launched the subkernels, I construct an association with ...
7
votes
1answer
99 views

about the design of Part related to Association

<|"a" -> 1, "b" -> 2, "c" -> 3, "d" -> 4|>[[1]] gives values 1 while ...
12
votes
1answer
252 views

10.0.2 mapping Association to Dataset warning

In 10.0.2 ExampleData[{"Dataset", "Titanic"}][All, <| "gender" -> #sex|> &] Outputs the expected result, but also throws: MapAt::partw: Part ...
7
votes
1answer
186 views

Did 10.0.2 break some forms for named slots?

Since 10.0.2 some code that previously worked using named slots fail in very particular circumstances. Attchd screenshot shows the issue w/ a particular Dataset ...
7
votes
1answer
183 views

BUG: AssociationMap loses definition

I'm facing a strange behavior of AssociationMap. With a fresh Kernel session: ...
0
votes
0answers
46 views

Could It get more efficient way (fastest)?

Before Mathematica 10, If I need something like a Map, dictionary I used to make something like: ...
4
votes
1answer
69 views

How can Map be given access to the keys of a Dataset?

Consider an example Dataset: ...
10
votes
3answers
159 views

How can a key be renamed in an Association?

Consider an example Association: assoc = <|"a" -> 1, "b" -> "x", "this_key_is_too_long_to_type" -> {1}|>; ...
8
votes
4answers
202 views

How can a field be efficiently added to a Dataset?

Let's use the example Dataset: ...
11
votes
2answers
159 views

Listable functions thread over Associations; is this documented?

Thanks to a somewhat misapplied use of MapThread I learned of this behavior: ...
7
votes
3answers
133 views

How does MapThread work with Associations

According to the documentation, MapThread works on Association objects. But it doesn't seem to evaluate the passed function. For ...
2
votes
0answers
45 views

Automating constructor definitions (OptionValue eval time)? [duplicate]

I'm settling in on a programming pattern for "constructors." I can illustrate the pattern with the following example, which defines a constructor newBar for ...
15
votes
0answers
131 views

A bug in the overloading of MemberQ and FreeQ for Association?

Bug introduced in 10.0.0 While answering Pattern match for nested Association I came across behavior of MemberQ and FreeQ in ...
4
votes
3answers
112 views

Pattern match for nested Association

Suppose I have Association testAssoc=Association[a->Association[1->1,2->2],b->Association[1->1,2->2]] which ...
0
votes
1answer
58 views

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 &|> ...
6
votes
3answers
206 views

GroupBy a list of associations with their keys

How can I go from ...
4
votes
3answers
86 views

Save associations to a file and reload

I have many (say 2 for now) associations that I want to save to a file ...
4
votes
1answer
94 views

Casting Dataset internal type from Assoc to Struct

Using: planets = ExampleData[{"Dataset", "Planets"}]; The full form of this projection displays the internal type def: ...
1
vote
0answers
80 views

Bug? Side effects when exporting to .mx

I seem to have encountered a bug when exporting to .mx, at least on OS X. Can anyone reproduce this? I am on MMA 10, OS X 10.9.4. ...
6
votes
1answer
91 views

Held keys in associations

Jacob Akkerboom commented: Note that PositionIndex does work correctly with held expressions, whereas this is a bit painful to implement using ...
8
votes
0answers
637 views

Dataset in Mathematica 10.0.1

Wolfram pages "Mathematica Quick Revision History" in Mathematica 10.0.1 release says: "New operators and compositions of operators enabled for associations functions such as Dataset and Query" ...
10
votes
5answers
261 views

Applying a function to a Dataset column conditional on another slot's value

How to apply a function to a column conditional on another slot's value? The Dataset documentation show only how to apply a function to named slots independently. The ...
5
votes
1answer
125 views

Mapping over an association producing an unexpected result

The documentation for associations says that the keys of an association are transparent for many operations. Map is one such operation. However, I am confronted ...
1
vote
0answers
45 views

How to pattern match an association? [duplicate]

I have the following: Clear[a, b]; a = {{1, 2, 3}, {4, 2, 5}, {6, 7, 8}}; b = GroupBy[a, #[[2]] &]; b whose output is: ...
6
votes
2answers
131 views

DeleteMissing level spec confusion

Given: titanic = ExampleData[{"Dataset", "Titanic"}] Why does this correctly delete Missing[] elements: ...
8
votes
2answers
128 views

Missing: KeyGroupBy?

Especially in tree-structured data, keys and values, being two sides of the same coin, frequently interchange roles. The ability to aggregate by value but not by key upsets the balance. How to ...
3
votes
1answer
96 views

How to efficiently select elements from a Hash?

How can I write an efficient version of the following selection statement: Keys[Select[hash, # < constant &]]; // AbsoluteTiming hash can be made from: ...
6
votes
1answer
110 views

Only String Keys supported in Dataset's Association Query?

fixed in 10.0.2 Given data: titanic = ExampleData[{"Dataset", "Titanic"}] This Association Query works: ...
9
votes
2answers
185 views

Extracting values with multiple keys

I want to extract sorted data from a huge database based upon two (or more) keys in a very timely manner. Here is a reproducible toy example for two keys only: ...
9
votes
3answers
147 views

Problem constructing Association tables with some operators

fixed in 10.0.2 First, set up the example Dataset from the documentation: titanic = ExampleData[{"Dataset", "Titanic"}]; ...