17,428 reputation
13983
bio website
location
age
visits member for 2 years, 8 months
seen 9 hours 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
1
revised Programming paradigm change
argh, another missing word (proof-reading skills need work)
Sep
1
answered Understanding `Paste` and how to get a string from the Clipboard to use with `ImportString`
Sep
1
revised Programming paradigm change
some missing words were bugging me enough to overcome my resistance to bumping this post back onto the active list
Aug
31
comment Converting structured data to a dataset
An example of converting XML to a dataset can be found here.
Aug
31
answered Import iTunes xml data and convert it into a dataset or table
Aug
31
answered Advanced SQL-type select statements (filtering) on Datasets
Aug
30
comment Group dataset on two keys (GroupBy)
You can correct the problem you describe by replacing ds[Values, Values] with this ugliness: ds[Values /* (KeyUnion[#, {} &] &)][All, Values]. It fills in absent keys, ensuring that the columns "line up". This could all probably be baked into a single query but I, like you, am not sure what to make of that intermediate result. Oh, and I'm sure that we'd also run into the operator-form bug you reference. The type information in ds is messed up as written, but it can be fixed up by changing the GroupBy operator form to an explicit function (GroupBy[#, ...]&).
Aug
30
answered How to lookup by a string key after GroupBy? Inconsistent data type handling
Aug
30
revised Problem constructing Association tables with some operators
changed an incorrect word, minor reformatting, amplification
Aug
30
answered Problem constructing Association tables with some operators
Aug
29
comment Splitting strings at lower case characters and numbers
No, regex is the only way to express look-ahead or look-behind conditions. A shame, really, because regex patterns are ugly as sin... but it sure is nice to have the PCRE engine to draw upon for those tougher jobs.
Aug
28
answered Splitting strings at lower case characters and numbers
Aug
28
awarded  Enlightened
Aug
28
awarded  Nice Answer
Aug
28
comment Change dataset key name
@Pickett I believe it should work, and I reported a bug to WRI. Consider that Dataset[<| a -> 1 |>][KeyMap[f]] works, but Dataset[<| "a" -> 1 |>][KeyMap[f]] doesn't. Looks like a bug to me.
Aug
28
revised Change dataset key name
added the `AssociationThread` method
Aug
28
answered Change dataset key name
Aug
28
comment Change dataset key name
+1 This could also be expressed as dataset[All, Normal /* (# /. "b" -> "h" &) /* Association].
Aug
28
comment How do I tweak the input assistant to use string completion on my own functions?
Let's close it instead of deleting it -- you won't be the last person to use that search term.
Aug
28
answered How do I tweak the input assistant to use string completion on my own functions?