MathGroup Archive 1994

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

Search the Archive

Re: Special Input Forms

  • To: mathgroup at yoda.physics.unc.edu, wasfy at gac.edu
  • Subject: Re: Special Input Forms
  • From: bert at netcom.com (Roberto Sierra)
  • Date: Mon, 10 Jan 1994 01:21:04 -0800

<<
Does anyone know how to make shorthand input forms in Mathematica?
[deleted]
Specifically, I would like an expression like the
following:

  2 +/- 3

to evaluate to

  Uncertainty[2,3]
>>

You're talking about adding new shorthands to the MMA parser.
To the best of my knowledge, this is not possible at the input
prompt level.  The best you might do is to play games with
object rules, for instance, by defining +/-3 as the 'object'
UncertainInteger[3], and then making a rule so that

	2 + UncertainInteger[3]

reduces to

	Uncertainty[2,3]

(similarly, 2 - UncertainInteger[3] would give the same answer).

If you *really* want to be able to use the syntax 2 +/- 3, you're
going to have to write your own parser (either external to MMA,
or through an MMA function like MyParser[s_String]) that would
catch the '+/-' cases and convert them to Uncertainty function
calls.  Given the complexity of the precedence rules for MMA's
language syntax, I think this will be a waste of effort.


 \\|//                         "An intellectual carrot...
  - -                           The mind boggles!!"
  o o                                   -- The Thing (1951)
   J   roberto sierra
   O   tempered microdesigns    NOTICE:
  \_/  san francisco, ca        The ideas and opinions expressed
       bert at netcom.com          herein are not those of the author.





  • Prev by Date: Using Read List to read FORTRAN output
  • Next by Date: Xwindow warning
  • Previous by thread: Special Input Forms
  • Next by thread: Re: Special Input Forms