Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4339

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

From "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Just another Mathematica "Gotcha", and HoldForm bug
Date 2011-08-12 09:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j22qc6$gnd$1@smc.vnet.net> (permalink)
References <j1r5d3$fi4$1@smc.vnet.net> <j1tnpf$pnu$1@smc.vnet.net>

Show all headers | View raw


On Thu, 11 Aug 2011 10:12:07 +0100, Richard Fateman  
<fateman@cs.berkeley.edu> wrote:

> Simple experiments
> are not enough, though, as shown by 6, which suggests that
> /. applies rule(s) to everything to the left, and 7 which
> suggests that // applies an operator to everything
> to the left.  Both of these are false. See a=b/.f;  a=b//f.
>

Looking at the FullForm is simple, albeit not an experiment. Also simple  
(though for some reason not documented) is querying the precedence of the  
operators directly:

Precedence[ReplaceAll] = 110.

Precedence[Postfix] = 70.

which is to say, of course, that

Precedence[ReplaceAll] > Precedence[Postfix] = True

which is as direct a statement of this fact as I think you'll ever find.

> 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?

> While it is easy to place blame on "user error", I think "design error"
> contributes to difficulties as well.
>

Yes, I dare say that many practically-minded users would find it easier to  
solve their real-world problems in Mathematica if it were based on Prolog  
or some similarly widely used language in which the order in which  
relations are stated is inconsequential. (Being serious for a moment,  
users do have the option to code in FullForm if they wish precedence to be  
explicit. For some reason, though, most seem not to prefer this...)

Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Just another Mathematica "Gotcha" AES <siegman@stanford.edu> - 2011-08-09 11:24 +0000
  Re: Just another Mathematica "Gotcha" David Bailey <dave@removedbailey.co.uk> - 2011-08-10 10:45 +0000
  Re: Just another Mathematica "Gotcha" Richard Fateman <fateman@cs.berkeley.edu> - 2011-08-10 10:50 +0000
    Re: Just another Mathematica "Gotcha", and HoldForm bug Richard Fateman <fateman@cs.berkeley.edu> - 2011-08-11 09:12 +0000
    Re: Just another Mathematica "Gotcha", and HoldForm DrMajorBob <btreat1@austin.rr.com> - 2011-08-12 09:06 +0000
    Re: Just another Mathematica "Gotcha", and HoldForm bug "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-12 09:05 +0000
    Re: Just another Mathematica "Gotcha", and HoldForm bug "Oleksandr Rasputinov" <oleksandr_rasputinov@hmamail.com> - 2011-08-12 09:06 +0000
      Re: Just another Mathematica "Gotcha", and HoldForm bug Richard Fateman <fateman@cs.berkeley.edu> - 2011-08-27 12:18 +0000
    Re: Just another Mathematica "Gotcha", and HoldForm Murray Eisenberg <murray@math.umass.edu> - 2011-08-12 09:13 +0000
  Re: Just another Mathematica "Gotcha" "Kevin J. McCann" <kjm@KevinMcCann.com> - 2011-08-10 11:00 +0000
  Re: Just another Mathematica "Gotcha" Roger Wilson <rogerhw999@gmail.com> - 2011-08-11 07:26 +0000
  Re: Just another Mathematica "Gotcha" Simon <simonjtyler@gmail.com> - 2011-08-11 07:26 +0000
  Re: Just another Mathematica "Gotcha" DrMajorBob <btreat1@austin.rr.com> - 2011-08-11 09:11 +0000

csiph-web