Re: Sometimes <space> means multiple , sometimes not
- To: mathgroup at smc.vnet.net
- Subject: [mg75410] Re: Sometimes <space> means multiple , sometimes not
- From: Szabolcs <szhorvat at gmail.com>
- Date: Sat, 28 Apr 2007 06:03:50 -0400 (EDT)
- Organization: University of Bergen
- References: <f0sf31$n0k$1@smc.vnet.net>
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?) 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.) 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]. 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. I'm not sure if I would trade space as multiplication for [] as Part. Probably I wouldn't. Szabolcs