MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Sometimes <space> means multiple , sometimes not

  • To: mathgroup at
  • Subject: [mg75418] Re: Sometimes <space> means multiple , sometimes not
  • From: Vince Virgilio <blueschi at>
  • Date: Sun, 29 Apr 2007 03:11:48 -0400 (EDT)
  • References: <f0sf31$n0k$><f0v6sg$957$>

On Apr 28, 6:15 am, Szabolcs <szhor... at> wrote:
> Virgilio, Vincent - SSD wrote:
> > Personally, I think it was a mistake to overload the meaning of "space"
> > to multiply. I bet Wolfram Inc. would reverse that decision now, if it
> > wasn't for backward compatibility.
> > I like to compare Mathematica to C++. Somewhere in his writings, Bjarne
> > Stroustrup mentions the same issue, and his decision not to overload
> > whitespace. I think the question also arises on the Boost mailing lists
> > now and then, mostly tongue-in-cheek.
> > (Corrections welcome.)
> > Vince Virgilio
> Why do you think that it was a bad idea to use space for multiplication?
> (What are the drawbacks?)

Because it's too obscure, and leads to "quiet changes" (Original
Principles of the C9x Charter, Point 4:
My eyes lose such space in the jiggling masses of notebook whitespace.
And if you're in an "m" file, the convenience can become a hinderance
through negative interaction with version control and the "diff" tool.
Also, if you're in an "m" file, why bother with convenience; aren't
you writing for eternity? (Opposite to the argument used by
Mathematica advocates to parry charges of slow execution.)

> I think that Mathematica is a bit different than C++ because in C++
> people usually write relatively short expressions where they multiply
> numbers (using space for multiplying numbers makes the code unreadable)
> and a few variables. In C++ expressions are used to calculate something
> (they are not kept in symbolic form).
> Since in Mathematica it is possible to work with symbols, most often the
> expressions themselves are manipulated (and not numbers). Expressions
> can get very big, and I find it really convenient that the operator
> denoting multiplication can be typed without the shift key. (You have to
> hold down shift to type * on an English keyboard.)

That's a matter of style. I try to write smaller input expressions;
I'm no fan of one-liners.

> However, there is a real drawback: if space is used for multiplication,
> f(x) is equivalent to f*x, so applying the function f to x needed a
> different notation: f[x]. . . .

Interesting. Are you certain about that? The function call syntax is
jarring initially (but it's grown on me). It's also an impediment to
evangelization. Almost, people next expect you to paint your face

> . . . This led to using [[ ]] for Part, which can be
> very unreadable again. Unfortunately the front end does not change [[
> automatically to \[LeftDoubleBracket], and typing <esc>[[<esc> is tedious.

Style can help here too. I /try/ not to vivisect my expressions too
often, and rather work with them as a whole. Semantic approaches to
clarity leverage much more than syntactic ones. So the less often I
use Part, the less often its awkward syntactic expression matters.

> I'm not sure if I would trade space as multiplication for [] as Part.
> Probably I wouldn't.

I would trade spacey multiplications (thumb press) for starry ones
(pinky press and an afterthought) to eliminate obscurity, quiet
changes, and unpredictability.

But really, who could've known? This decision was probably made
decades ago.

> Szabolcs


Vince Virgilio

  • Prev by Date: Re: Fourier and InverseFourier
  • Next by Date: Re: RE: Re: Sometimes <space> means multiple
  • Previous by thread: Re: Sometimes <space> means multiple , sometimes not
  • Next by thread: an expression with logs