Search Results
Search type | Search syntax |
---|---|
Tags | [tag] |
Exact | "words here" |
Author |
user:1234 user:me (yours) |
Score |
score:3 (3+) score:0 (none) |
Answers |
answers:3 (3+) answers:0 (none) isaccepted:yes hasaccepted:no inquestion:1234 |
Views | views:250 |
Code | code:"if (foo != bar)" |
Sections |
title:apples body:"apples oranges" |
URL | url:"*.example.com" |
Saves | in:saves |
Status |
closed:yes duplicate:no migrated:no wiki:no |
Types |
is:question is:answer |
Exclude |
-[tag] -apples |
For more details on advanced search visit our help page |
General guidelines and best practices for Mathematica usage and programming.
17
votes
What are recommended guidelines for developing packages?
While @Albert gave an excellent answer, here are my two cents:
Naming
One thing which is true almost always: make your context name for the package the same as the file name for that package (without …
15
votes
Resource management in Mathematica
This question was indeed discussed on SO, here. I am usually using the version of CleanUp function by WReach, from that answer. It is however not fully bulletproof, as I noted in comments to that answ …
154
votes
Accepted
How to compile effectively?
I'll just throw in a few random thoughts in no particular order, but this will be a rather high-level view on things. This is necessarily a subjective exposition, so treat it as such.
Typical use cas …
9
votes
Naming convention for symbols exported from package
I personally use capitalized names for exported symbols, and think that this is the recommended practice generally (for example, Roman Maeder suggests this convention in his book, which is, while date …
7
votes
Nested association values validation. POJsO handling
General
The real problem with objects is that sooner or later you really start to want some of the fields mutable. And once you want it, you really open a can of worms. Also, for methods, you will fi …
27
votes
Error checking and trapping techniques with Throw and Catch
I have answered almost exactly this question (somewhat more general one, if we interpret this one as being concerned only with Throw and Catch) here. Since you asked a more narrow one, I feel it may …
93
votes
General strategies to write big code in Mathematica?
Preamble
I had a talk devoted specifically to this topic, on Second Russian WTC in 2014. Unfortunately, it is in Russian. But I will try to summarize it here.
Since this post is becoming too long, I d …
39
votes
General strategies to write big code in Mathematica?
Managing the complexity III: using powerful abstractions
In this section I will list a few techniques which allow one to write more modular code and better separate the concerns, by using certain pow …
78
votes
Accepted
Functions with Options
The main change since that time seems to be that the modern way of using options is associated with OptionsPattern[] - OptionValue commands. A typical way of defining a function would be:
Options[f …
79
votes
Accepted
General strategies to write big code in Mathematica?
Managing the complexity, II: controlling complexity on the smaller scale
There are a few things you can do to control and reduce the complexity of your code, even on the small scale - long before you …
20
votes
Accepted
How to unload automatically loaded packages?
If you want to revert the entire system to some state, then CleanSlate` may be the best option. If you want to unload a few specific packages though, you can use my package PackageManipulations`, avai …
14
votes
Functional programming Style & Performance
This is not a question of functional style per se. Functional style is, AFAICT, largely about avoiding mutable state (where possible), using functions as fundamental building blocks, using certain abs …
20
votes
Remove versus ClearAll
ClearAll clears all definitions associated with the symbol. However, the symbol remains in the symbol table, so all references to that symbol from other symbols (their definitions) remain fully valid. …
61
votes
Accepted
Changing Values in an Association using Map
Preamble
This is a very good question, because answering it will make it very clear what immutability means, both in general and in the context of Associations.
General
A few general words on immutabi …