MathGroup Archive 2013

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

Search the Archive

Text based interface: $PreRead does not work as manual says.

  • To: mathgroup at smc.vnet.net
  • Subject: [mg130716] Text based interface: $PreRead does not work as manual says.
  • From: Alain Cochard <Alain.Cochard at unistra.fr>
  • Date: Mon, 6 May 2013 02:26:13 -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

Here is an excerpt of
http://reference.wolfram.com/mathematica/ref/$PreRead.html

    Use as an alias for HoldForm:

    In[1]:= $PreRead = ReplaceAll[#, "hf" -> "HoldForm"] &

    Out[1]= #1 /. hf -> HoldForm & 

    In[2]:= {hf[2 + 3], hf[2/3]}

                  2
    Out[2]= {2+3, -]}
                  3

Using the text based interface, I try to reproduce the above:

    Mathematica 9.0 for Linux x86 (64-bit)
    Copyright 1988-2012 Wolfram Research, Inc.

    In[1]:= $PreRead = ReplaceAll[#, "hf" -> "HoldForm"] &

    Out[1]= #1 /. hf -> HoldForm & 

    In[2]:= {hf[2 + 3], hf[2/3]}

                       2
    Out[2]= {hf[5], hf[-]}
                       3

    In[3]:= hf

    Out[3]= hf

    In[4]:=?hf

    Global`hf


Other Mathematica version, other computer:

   Mathematica 8.0 for Linux x86 (32-bit)
   Copyright 1988-2011 Wolfram Research, Inc.

   In[1]:= $PreRead = ReplaceAll[#, "hf" -> "HoldForm"] &

   Out[1]= #1 /. hf -> HoldForm & 

   In[2]:= {hf[2 + 3], hf[2/3]}

                      2
   Out[2]= {hf[5], hf[-]}
                      3

   In[3]:= hf

   Out[3]= HoldForm <<<< so here it understands a litte bit...

And I get the same output as just above, with

   Mathematica 7.0 for Linux x86 (64-bit)
   Copyright 1988-2009 Wolfram Research, Inc.

on yet another computer.

However, it does work as expected when using the front end interface.

Is this normal?  

I spent some time in the documentation and on the web for an alternative
of $PreRead but did not find anything, apart from the obsolete "Alias"
Mathematica function; I found a documentation here:
http://reference.wolfram.com/legacy/v4-fr/OtherInformation/Alias_almark.html
I tried the simple example which is provided, but it does not react as
it should, neither with the text based nor the front end interfaces...

Is there something I can do to restore the correct behavior of $PreRead,
or use Alias, under the text based interface or is there an equivalent
way for defining such aliases?

Thanks in advance.
AC

-- 
EOST (Ã?cole et Observatoire des Sciences de la Terre) 
IPG (Institut de Physique du Globe) | alain.cochard at unistra.fr
5 rue René Descartes   [bureau 106] | Phone: +33 (0)3 68 85 50 44 
F-67084 Strasbourg Cedex, France    | Fax:   +33 (0)3 68 85 01 25     



  • Prev by Date: Re: (amusement) surprising result from PossibleZeroQ
  • Next by Date: Re: Mathematica-assisted learning was .. Re: Speak errors
  • Previous by thread: Re: very basic RecurrenceTable puzzle
  • Next by thread: Re: Text based interface: $PreRead does not work as manual says.