MathGroup Archive 2011

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

Search the Archive

Re: Just another Mathematica "Gotcha", and HoldForm bug

  • To: mathgroup at smc.vnet.net
  • Subject: [mg120829] Re: Just another Mathematica "Gotcha", and HoldForm bug
  • From: "Oleksandr Rasputinov" <oleksandr_rasputinov at hmamail.com>
  • Date: Fri, 12 Aug 2011 05:04:17 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <j1r5d3$fi4$1@smc.vnet.net> <j1tnpf$pnu$1@smc.vnet.net>

On Thu, 11 Aug 2011 17:01:50 +0100, Oleksandr Rasputinov  
<oleksandr_rasputinov at hmamail.com> wrote:

> On Thu, 11 Aug 2011 10:12:07 +0100, Richard Fateman  
> <fateman at cs.berkeley.edu> wrote:
>
>> In looking at examples, I think I found a bug, but maybe
>> it is a feature?
>>
>> Did you know that
>>
>> HoldForm[x //@ y]      returns  x//@y
>>    but
>> HoldForm[x //  y]      returns  y[x]
>>
>> ?
>> (version 7.0).
>>
>
> //@ is a sigil representing the infix form of MapAll. An interpretation  
> of the first expression as postfix immediately followed by prefix  
> function application which you seem to be suggesting as a possibility  
> would not be meaningful: what would its (syntactically correct) FullForm  
> be?
>

On further consideration it strikes me that I may have misunderstood what  
you meant here. HoldForm is simply printing the expressions in InputForm,  
so for example we also have

HoldForm[MapAll[x,y]]

printing:

x //@ y

Conversion between two equivalent syntactic forms (postfix notation, and  
InputForm) is not considered to be a form of evaluation; it is simply the  
way in which the expressions are parsed. If you want an expression that  
prints in a particular way you can use

HoldForm@Postfix[x // y]

or indeed

HoldForm@FullForm[MapAll[x, y]]

both of which print retaining the expressions in the forms specified.




  • Prev by Date: Re: work?
  • Next by Date: Re: Just another Mathematica "Gotcha", and HoldForm
  • Previous by thread: Re: Just another Mathematica "Gotcha", and HoldForm
  • Next by thread: Re: Just another Mathematica "Gotcha", and HoldForm bug