Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #4808
| From | Patrick Scheibe <pscheibe@trm.uni-leipzig.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Print bug with -script? (quotes display) |
| Date | 2011-09-07 09:47 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <j47eju$l5d$1@smc.vnet.net> (permalink) |
| 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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Print bug with -script? (quotes display) Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-09-05 11:17 +0000 Re: Print bug with -script? (quotes display) Alan <alan.isaac@gmail.com> - 2011-09-06 07:59 +0000 Re: Print bug with -script? (quotes display) Alan <alan.isaac@gmail.com> - 2011-09-06 08:00 +0000 Re: Print bug with -script? (quotes display) Alan <alan.isaac@gmail.com> - 2011-09-06 08:07 +0000 Re: Print bug with -script? (quotes display) Patrick Scheibe <pscheibe@trm.uni-leipzig.de> - 2011-09-07 09:47 +0000
csiph-web