Linked Questions

528
votes
19answers
132k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
111
votes
7answers
14k views

Struct equivalent in Mathematica?

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
65
votes
6answers
3k views

V10's Operator Forms - what are they good for?

V10 introduces an operator form for several functions perhaps primarily due to their role in queries as part of introducing data science functionality. At first pass it seems a lot of effort to add ...
50
votes
3answers
4k views

Changing Values in an Association using Map

I am trying to change the value of one key in an association based on the value of another key in that association. So if my association starts as: ...
47
votes
2answers
3k views

Memoization with pure functions?

Is this possible? If I have a simple function, say: f=If[#>0,1,2]& then for each value of # this will re-evaluate f right? Is it possible to define a ...
15
votes
6answers
681 views

Reshaping associations, generalization of GroupBy

Let's say we have a set a\of associations: ...
18
votes
3answers
7k views

Implementing a dictionary data structure

As one learns from a course on data structures, hash maps or dictionaries can be efficient when applied to appropriate tasks. I need a hash map in Mathematica and I've never found it. I'm scratching ...
14
votes
3answers
7k views

Assigning values to a list of variable names

As part of a calculation I need to do something like this Evaluate[{aaa, bbb, ccc}[[ index]]] = {1, 2, 3, 4, 5} so if index is ...
11
votes
3answers
722 views

Does Mathematica have Month Range and Day range?

It is known that CharacterRange["a", "z"] gives list of characters from a to z. Does Mathematica have something similar for weekdays and months of the year? ...
9
votes
4answers
334 views

Create Nested List from tabular data

Im trying to create a nested list from tabular data, then onward into a nested association. I can get part way with the help of this answer but it only works for the first level. Repeated use of this ...
38
votes
1answer
2k views

Which Object-oriented paradigm approach to use in Mathematica?

Which Object-Oriented Paradigm (OOP) approach to use in Mathematica for: general implementation, or a particular project? There are a lot of related questions and answers in MSE on doing OOP that ...
3
votes
3answers
1k views

Assigning to multiple variables in a list the values in another list

I have two lists, one contains the variables and the other the corresponding values that the variables should take. ...
7
votes
1answer
232 views

How does thing[“property”] syntax work?

Many builtin "things" support the (usually undocumented) syntax thing["property"], and usually the available properties can be listed using thing["Properties"] (thing["Methods"] might work too). ...
9
votes
2answers
539 views

Association and rudimentary object-oriented programming

Doesn't Association provide us rudimentary object oriented programming via constructs like ...
8
votes
2answers
159 views

Timing: extracting from List VS extracting from Association

I was wondering, why is extracting from an Association slightly faster than extracting from a List? ...

15 30 50 per page