MathGroup Archive 2011

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

Search the Archive

Re: Just another Mathematica "Gotcha"

  • To: mathgroup at
  • Subject: [mg120916] Re: Just another Mathematica "Gotcha"
  • From: Daniel Lichtblau <danl at>
  • Date: Mon, 15 Aug 2011 02:25:53 -0400 (EDT)
  • Delivered-to:

----- Original Message -----
> From: "Murray Eisenberg" <murray at>
> To: mathgroup at
> 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
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

  • Prev by Date: Arbitrary graph decorations
  • Next by Date: Re: Getting the Date and Time From a Time Server
  • Previous by thread: Re: Just another Mathematica "Gotcha"
  • Next by thread: Graph plotting problem