|
[Date Index]
[Thread Index]
[Author Index]
new special forms
- To: mathgroup at yoda.physics.unc.edu
- Subject: new special forms
- From: madler at cco.caltech.edu (Mark Adler)
- Date: 6 May 1994 00:50:47 GMT
Mathematica provides ~ for using a function in infix form. However,
I would like a way to make my own special forms that don't need ~.
For example, I'd like 3_-5 to mean 3 10^-5. In the quest for a way
to enter numbers in scientific notation more easily, I came up with
this kludge:
Unprotect[StringJoin]
StringJoin[m_?NumberQ,e_?NumberQ] := m 10^e
Protect[StringJoin]
Then 3<>-5 gives 3 10^-5, and does not interfere with the normal
operation of <>. This has two drawbacks: a) it's a little cumbersome
to type and so is only marginally better than blank 10^, and b) the
precedence is high, but not quite high enough, since something like
(#^2)& @ 3<>-5 gives 9 10^-5 instead of 9 10^-10.
So, the questions are: is there any way to define my own special form
with my own specified precedence and operation? Is there a way to
redefine a higher precedence form like ? or :: (I couldn't find a
way)? Is there some other completely different approach to this
problem? Thanks.
mark
Prev by Date:
Re: options PlotStyle and AxesOrigin in 3D-plots ?
Next by Date:
RE: ListContourPlot3D ?
Previous by thread:
Re: options PlotStyle and AxesOrigin in 3D-plots ?
Next by thread:
Re: new special forms
|