Re: Sometimes <space> means multiple , sometimes not
- To: mathgroup at smc.vnet.net
- Subject: [mg75418] Re: Sometimes <space> means multiple , sometimes not
- From: Vince Virgilio <blueschi at gmail.com>
- Date: Sun, 29 Apr 2007 03:11:48 -0400 (EDT)
- References: <f0sf31$n0k$1@smc.vnet.net><f0v6sg$957$1@smc.vnet.net>
On Apr 28, 6:15 am, Szabolcs <szhor... at gmail.com> 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: http://www.open-std.org/jtc1/sc22/wg14/www/charter). 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 blue. > . . . 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 Regards, Vince Virgilio