Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2011

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

Search the Archive

Re: Print bug with -script? (quotes display)

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121287] Re: Print bug with -script? (quotes display)
  • From: Patrick Scheibe <pscheibe at trm.uni-leipzig.de>
  • Date: Wed, 7 Sep 2011 05:41:19 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201109042206.SAA21519@smc.vnet.net> <j42b57$rsl$1@smc.vnet.net>

Hi,

> Can you name another language where printing a string
> to standard out will print the delimiters used to
> create a string literal?  I cannot.

What you forget is that in other languages usually *only* strings get
printed. When you need to print a number you have to convert it to a
string. In Mathematica you print *Expressions* which is why you can do 

Print[Sqrt[3]]

or

Print[Image[{{0, 1}, {1, 0}}]]

in a notebook. Did you ever complain about that? If you try these two
examples in console-mode you get different results.

> (But I'm new to Mathematica and willing to
> listen to reasons for this surprising behavior.)

The surprising behavoir I see is that in console-mode (you open a
console, type "math" and get an interactive Mathematica session) you can
of course do Print["hello"] and you get the hello without quotes.
I assume one has just to accept that console-mode makes more formating
than the -script mode. Look at Print[1/2]. In console-mode you get a
nice rational form, in -script mode just the 1/2 is printed.

Look at the bright side: Although very surprising, it can be fixed for
you with one simple line of code.

Cheers
Patrick  





  • Prev by Date: Re: Texture in version 8, fine, but don't export...?
  • Next by Date: NonlinearModelFit and "ANOVATable" and "ParameterConfidenceIntervalTable"
  • Previous by thread: Re: Print bug with -script? (quotes display)
  • Next by thread: Re: Print bug with -script? (quotes display)