MathGroup Archive 2005

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

Search the Archive

Re: Re: Question regarding Mathematica's treatment of whitespace

  • To: mathgroup at smc.vnet.net
  • Subject: [mg61882] Re: [mg61869] Re: Question regarding Mathematica's treatment of whitespace
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Thu, 3 Nov 2005 04:58:51 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <dk1k2g$9p9$1@smc.vnet.net><dk4cun$rum$1@smc.vnet.net> <200511020909.EAA06991@smc.vnet.net>
  • Reply-to: murray at math.umass.edu
  • Sender: owner-wri-mathgroup at wolfram.com

But in Mathematica, the semicolon is NOT a terminator at all.  Rather, 
it's a SEPARATOR -- between parts of a CompoundExpression.  (Something 
of the form "a;b;...", etc.)

When the user omits the final statement in the compound expression, as 
in "a;b;" then Mathematica inserts Null as that missing final statement. 
  Since Null is normally not printed as a result, the effect is to 
display no output whatsoever.

It's as sensible to insist that Mathematica "should" adopt this or that 
syntactical convention of some other programming language, as to insist 
that, say, English should obey the syntax rules of some other natural 
language.


carlos at colorado.edu wrote:
> Mathematica should mandate ; as terminator of any expression,
> as in C.   Then problems such as the one noted by the OP
> would disappear: with CR/LF uniformly ignored source interpretation
> becomes more linebreak independent.
> 
> Also the common warning about "this statement
> will be interpreted as implicit  multiplication" in modules, with
> consequent risk of infinite recursion, would go away.
> 
> To get an expression printed  a short  construct  such as
> 
>        a = Sin[Pi/2]   >>;
> 
> which outputs "a=1" could be introduced to avoid the
> verbosity of Print.  This could be easily edited in and out in
> module debugging.
> 
> 

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: How was this typed?
  • Next by Date: Re: pattern matching question
  • Previous by thread: Re: Question regarding Mathematica's treatment of whitespace
  • Next by thread: Re: Question regarding Mathematica's treatment of whitespace