19,313 reputation
14386
bio website
location
age
visits member for 2 years, 10 months
seen 13 mins 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.


Nov
17
comment String pattern defined by number of characters
@Aisamu There is no direct equivalent in Mathematica's native string pattern syntax. It is probably possible to achieve a similar result using StringCases[s, $patt] where $patt is self-referential. The following pattern comes close, but it fails to preserve proper backtracking: $patt = "b" | "c" | ("a" ~~ (s___ /; StringMatchQ[s, $patt]) ~~ "d"). Even if it worked, it entails an evaluator callback from the PCRE engine for every potential match -- probably more trouble than it is worth.
Nov
17
revised String pattern defined by number of characters
added 59 characters in body
Nov
17
answered String pattern defined by number of characters
Nov
17
answered GroupBy and MaximalBy to create a new Dataset
Nov
17
answered How to get data from DB into dataset with keys
Nov
11
answered How to write Mma notebook input that modifies itself?
Nov
11
comment Pattern matching: Times[a_] vs Times[a__]
@ShutaoTang The Internal package is undocumented, and we use its features at our own risk since it carries no guarantees and could be withdrawn at any time. As the name implies, it is used internally by the Mathematica implementation. There is no official documentation on this package, but this forum is rapidly becoming the repository for the collective findings of the community -- whether about Internal or many of the other undocumented features. And even the documented ones too :)
Nov
11
comment Select last occurence of key in dataset
@Lea As to the dollar sign in $dataset, see the second FAQ in my profile.
Nov
11
revised Select last occurence of key in dataset
added sample data in copy-and-paste form
Nov
11
answered Select last occurence of key in dataset
Nov
11
revised Pattern matching: Times[a_] vs Times[a__]
added 3 characters in body
Nov
11
answered Pattern matching: Times[a_] vs Times[a__]
Nov
8
awarded  Nice Answer
Nov
8
awarded  Revival
Nov
8
comment Using 0 to create new columns in a list with Part
@AlexeyPopkov Okay, okay... A New Kind of Map/Apply = A New Kind of Maple ;D
Nov
8
comment Copy/Paste of quoted text crashing Mathematica 10?
I can reproduce the crash on V10.0.1, Windows 7, 64-bit.
Nov
8
answered Is there is a design problem or documentation problem with FirstCase?
Nov
8
comment Using 0 to create new columns in a list with Part
A New Kind of Map :)
Nov
8
answered Using 0 to create new columns in a list with Part
Nov
6
revised How can Map be given access to the keys of a Dataset?
added 12 characters in body