18,153 reputation
13983
bio website
location
age
visits member for 2 years, 9 months
seen 1 hour ago

Frequently Asked Questions

WReach? Is that connected to WRI somehow?

The "WR" in my name has nothing to do with the company that develops Mathematica. It is just a coincidence.

Why do you start all your global variable names with $?

I use dollar signs for ad hoc global variables because I have been bitten too many times by accidentally assigning an own-value to a symbol that I happen to use, for example, in a symbolic equation. So I am in the habit of writing $x instead of x. I stick to that convention even for longer symbols like $initialUrl. Just like the regular symbol convention, Mathematica's predefined global symbols all start with a capital letter after the $. My ad hoc symbols always start with a lower case letter, so there is no conflict.

Why do you put semicolons and commas at the beginning of the line instead of at the end like a normal person?

I don't think of it that way. Rather, I switch from horizontal to vertical layout when a single expression is too long to fit on one line. This has the interesting side-effect of making the important delimiters stand out and line up. I first ran into this practice in the SQL community. SQL "programs" have the unpleasant property that they must be written as a single statement -- even if that statement is a hundred lines long (or more!). Sometimes Mathematica expressions share that property.


Sep
26
comment Why does my dataset lose its typesetting when I add columns?
The impact of type inference upon typesetting is discussed in detail here. There might be enough information there for the present question to be considered a duplicate.
Sep
24
awarded  Autobiographer
Sep
24
comment How to replace the first occurance in an expression instead of replacing all?
+1 With version 10, we can use FirstPosition, e.g. HoldForm[x + 2 + 4 + x] // ReplacePart[#, FirstPosition[#, x] -> 4] &.
Sep
24
awarded  Nice Answer
Sep
22
comment Elementwise operation, part deux
The implementation of generators is explored in this question. But if you are finding Do to be non-performant then you'll really hate the solution proposed there :)
Sep
22
awarded  Enlightened
Sep
21
revised How to use Mathematica for traditional programming
added links
Sep
21
revised How to use Mathematica for traditional programming
added the link to How To Create a Lecture Notebook
Sep
21
answered How to use Mathematica for traditional programming
Sep
21
answered Composing function returning list and function taking multiple arguments
Sep
21
revised Writing this loop in Mathematica
minor code simplification
Sep
21
revised Writing this loop in Mathematica
fixed a copy-and-paste error
Sep
21
answered Writing this loop in Mathematica
Sep
21
revised Tracking Initialization
added the `UnsavedVariables` option to the last variant to correct the bad behaviour when the output cell was reloaded into a new session
Sep
20
revised How to “Copy as Unicode” from a Notebook?
described Uniclip.m and my failed attempt to wire the functionality into a context menu
Sep
20
comment How to “Copy as Unicode” from a Notebook?
@Mr.Wizard I spent a couple of hours today trying to fulfill the request, but failed. I kept hitting race conditions in re-entrant front-end calls while trying to hook up the context menu. This is because the only way I know how recover the text selection involves a front-end call, and the menu item invocation is already a front-end call. I can't really spend more time on it right now, so if anyone wants to incorporate uniclip into another answer that adds menu items and shortcut keys, feel free.
Sep
19
awarded  Generalist
Sep
18
comment DeleteMissing level spec confusion
DOH! I completely missed that DeleteMissing was on the list of descending operators. Another way to convert a descending operator to ascending is like this: #& /* DeleteMissing. Note that Identity /* DeleteMissing will not do the job as the Identity operator is optimized out (it is effectively on the list of descending operators). In context: titanic[GroupBy@Key@"class", #& /* DeleteMissing, "age"].
Sep
18
comment DeleteMissing level spec confusion
@alancalvitti Please transfer the "accept" to Taliesin's answer. I will then delete this response as it presents an incorrect analysis.
Sep
18
revised DeleteMissing level spec confusion
added the note that the analysis is incorrect