Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4424 > unrolled thread

Re: Just another Mathematica "Gotcha"

Started byDaniel Lichtblau <danl@wolfram.com>
First post2011-08-15 06:27 +0000
Last post2011-08-15 06:27 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Just another Mathematica "Gotcha" Daniel Lichtblau <danl@wolfram.com> - 2011-08-15 06:27 +0000

#4424 — Re: Just another Mathematica "Gotcha"

FromDaniel Lichtblau <danl@wolfram.com>
Date2011-08-15 06:27 +0000
SubjectRe: Just another Mathematica "Gotcha"
Message-ID<j2ae8p$9cm$1@smc.vnet.net>

----- Original Message -----
> From: "Murray Eisenberg" <murray@math.umass.edu>
> To: mathgroup@smc.vnet.net
> Sent: Sunday, August 14, 2011 7:15:56 AM
> Subject: Re: Just another Mathematica "Gotcha"
> Perhaps that would be a good rationale for Mathematica _not_ allowing
> a
> number to begin with a decimal point?
> 
> As things stand right now, Mathematica is rather forgiving about this.
> 
> For fun, I tried
> 
> .3/.3 -> a
> 
> to see that the period binds to the following 3 rather than to the /.

I think we were both joking, but here is my serious response.

(1) The situation you show, and which has bitten me on occasion, is indeed in the gotcha category.

(2) It is a bit uncommon.

(3) Less common still is the double dot as in
a..3
vs
a. .3
Neither is a terribly useful construct but both are syntactically correct. In the case of no white space the parsing is the opposite of your example, in that the second dot is placed lexically with the first.

(4) People of course often want to enter .3 without a leading 0. Disallowing that would be just unfriendly.

(5) Parsing 4.5/.3 as 4.5 divided by .3 is usually what is wanted, hence I think the parsing is doing the Right Thing (though I've no idea what that might mean in the case of item (3) above).

(6) Parsing as above, but with an exception for the case of the ".3" part being followed by infix Rule or RuleDelayed, is not an option. That would make the grammar context sensitive, if I am seeing the matter correctly. I won't discuss what this means, other than to say it needs to be avoided.

As there is no perfect fix, best just to declare it as not broken. 

Daniel Lichtblau
Wolfram Research

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web