MathGroup Archive 2011

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

Search the Archive

Re: pattern bugs and comment on intuitive syntax for the

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115160] Re: pattern bugs and comment on intuitive syntax for the
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Mon, 3 Jan 2011 03:55:22 -0500 (EST)

Have you sent these bugs to support at wolfram.com?  That's where bug 
reports should go.

Unless, that is, these are just issues as to how _you_ think Mathematica 
"ought" to behave vs. how it actually behaves.

On 1/2/2011 4:56 AM, Richard Fateman wrote:
>    Guess the results.
>
> x+3 /. x+c___ ->  aha[c]
> x /. x+c___ ->  aha[c]
> x /. x+c___:0 ->  aha[c]
>
> compare to
>
> x+y+3 /. x+y+c___ ->  aha[c]
> x+y  /. x+y+c___ ->  aha[c]
> x+y  /. x+y+c___:0 ->  aha[c]
> x+y+a+b  /. x+y+c___ :>  aha[c]
> x+y+a+b  /. x+y+c___ :>  aha[Plus[c]]
> x+y  /. x+y+c___ :>  aha[Plus[c]]
>
>
>
> I think the requirement for the :0 represents a bug. Maybe the
> need for the Plus[], too. The treatment of NullSequences within
> a Flat operator could be different, leaving an operator around.
>
> ............
>
> Another item. really, syntax.
>
> define
>
> GreaterThan[q_]:= #>q&
> gt2=GreaterThan[2]   (* a function of one argument.
>                           is that argument>  2? *)
>
>
> mm[2, 10] /. mm[q_, s_?GreaterThan[q]] :>  aha[q, s]
>
>    doesn't give aha..
>
>
> mm[2, 10] /. mm[q_, s_?gt2] :>  aha[q, s]
>
> does give aha
>
> this works, though.
> mm[2, 10] /. mm[q_, s_?(GreaterThan[q])] :>  aha[q, s]
>
> I love that intuitive syntax. None of that excess
> parentheses and stuff. (sarcasm)
>
> This error would have been
> much more apparent in Lisp.
>
> happy new year.
>
>
>
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305


  • Prev by Date: Re: pattern bugs and comment on intuitive syntax for the
  • Next by Date: Re: Import, ReadList, and Unicode
  • Previous by thread: Re: pattern bugs and comment on intuitive syntax for the
  • Next by thread: Re: Trial version of Mathematica 8 restrictions and a