23,708 reputation
250102
bio website
location
age
visits member for 3 years, 2 months
seen Mar 25 at 23:49

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.


Feb
16
comment Windows command line arguments, stdin & stdout
@William It accepts only one argument because I was following the lead of test.m. There is no essential obstacle to adjusting the Mathematica script to accept as many arguments as you like, and to evaluate them or not evaluate them as suits the application.
Feb
16
answered Change Values in Dataset under Condition
Feb
16
comment Windows command line arguments, stdin & stdout
@William I have added a section detailing the use of a cmd file to emulate the CYGWIN example in your response. Hopefully this version will get you closer to your goal. I have left out the pesky details concerning error handling, escaping, etc. The offer of a bounty is appreciated, but not necessary.
Feb
16
revised Windows command line arguments, stdin & stdout
Added a variation that uses a _cmd_ file.
Feb
16
comment Windows command line arguments, stdin & stdout
@William Fair enough. I've always avoided DOSKEY because it is not recognized anywhere but at the start of interactive command input. I would just use a normal cmd file (e.g. create _.cmd somewhere in the PATH). But we have now firmly left Mathematica and are well into superuser :)
Feb
15
revised Windows command line arguments, stdin & stdout
added the section about DOSKEY
Feb
15
comment Windows command line arguments, stdin & stdout
@William What was the nature of the failure? It all seemed to work for me when I tried it just now on Windows 7: stdin, stdout, command line arguments. I had to avoid breaking the command across lines since DOSKEY uses different escaping conventions than the command processor. Double-check that the defined macro takes the form you expect by inspecting DOSKEY /m.
Feb
15
awarded  Enlightened
Feb
15
awarded  Nice Answer
Feb
14
answered Windows command line arguments, stdin & stdout
Feb
14
comment Can I sum or mulitply 2 columns in a list of associations
@Mr.Wizard I gave it a shot.
Feb
14
answered Best way to modify values in a list of rules?
Feb
7
comment Convert recursive RegularExpression to StringExpression?
@Leonid +1. I started to write a comment pointing out the absence of {1, 24} from the solution, along with a revised expression to correct it. The revision proved to be difficult to find (for me, at least). So I have posted a TL;DR response describing my woes. Perhaps you (or someone else) can spot the flaw in my reasoning and present a simple solution.
Feb
7
answered Convert recursive RegularExpression to StringExpression?
Feb
5
comment Indexed Thread on dataset and list
@soandos An evaluation leak is a type of bug where a function evaluates an expression that should remain unevaluated. In the current example, the expression First@#2 is part of a function body and should not be evaluated until that function is called. Unfortunately, the type system accidentally evaluates that expression prematurely while trying to identify the type of the expression. This causes the message we see.
Feb
5
comment Indexed Thread on dataset and list
+1 We can dodge the warning message in 10.0.2 using something like ds[MapThread[Append[#, "age" -> #2 ] &, {#, ages}] &]. Messages like this are due to some serious evaluation leaks in the 10.0.2 type system code :(
Feb
4
answered Creating an autokey cipher function
Feb
4
comment Headings, subheadings, text cells etc and Alt+n
@Mr.Wizard I am unaware of any documentation for such key sequences. I somehow found out about it years ago (V5 or V6 maybe?), but I cannot remember if I read about it somewhere or it was just a lucky typing accident.
Feb
2
revised Can I sum or mulitply 2 columns in a list of associations
added 316 characters in body
Feb
2
answered Can I sum or mulitply 2 columns in a list of associations