Re: bug in InputForm (Mathematica 9)?
- To: mathgroup at smc.vnet.net
- Subject: [mg132500] Re: bug in InputForm (Mathematica 9)?
- From: Szabolcs HorvÃt <szhorvat at gmail.com>
- Date: Wed, 2 Apr 2014 02:36:53 -0400 (EDT)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- Delivered-to: l-mathgroup@wolfram.com
- Delivered-to: mathgroup-outx@smc.vnet.net
- Delivered-to: mathgroup-newsendx@smc.vnet.net
- References: <20140327085954.1A3806A26@smc.vnet.net> <lh38e7$rv6$1@smc.vnet.net>
note: also sent to comp.soft-sys.math.mathematica
On 2014-3-28, 3:30 , Itai Seggev wrote:
>> Put the following into a notebook cell:
>>
>> InputForm[1]
>> InputForm[2]
>> "test"
>>
>> Evaluate the cell. Only one of the InputForm commands produces output, and
>> that output comes after "test".
>>
>> I am guessing these behaviors are not intended ...
>>
>> Alan Isaac
>
> An old and well known bug, at least to those of us who work on Mathematica' s
> input/output system. :) Not as trivial to fix as you might think, because
> doing InputForm[foo] in a notebook lives in this strange world which is half
> command-line terminal and half notebook interface, and so wires can get
> crossed easily.
>
Marginally related to this, I'm curious how all these *Form functions work.
MatrixForm has this slightly confusing property:
In[1]:= a=MatrixForm[{{1,2},{3,4}}]
Out[1]//MatrixForm=
(1 2
3 4)
In[2]:= Head[a]
Out[2]= MatrixForm
In[3]:= Head[%1]
Out[3]= List
'a' cannot be used as a matrix because it is wrapped in MatrixForm. But
MarixForm is stripped before the expression is assgined to Out[1]. It
is also indicated (using Out[1]//MatrixForm) that the output is shown in
a special form.
How does MatrixForm achieve this, i.e. that it gets stripped from the
output and that it's shown in the cell label? Is there a general,
user-accessible mechanism for this? Can I create my own "form-function"
that behaves like this?
Szabolcs