MathGroup Archive 2002

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

Search the Archive

Re: MakeExpression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg33639] Re: MakeExpression
  • From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
  • Date: Thu, 4 Apr 2002 19:39:59 -0500 (EST)
  • Organization: Universitaet Leipzig
  • References: <a8g2di$b0t$1@smc.vnet.net>
  • Reply-to: kuska at informatik.uni-leipzig.de
  • Sender: owner-wri-mathgroup at wolfram.com

Hi,

a_Plus in your definition is nonsense. A head Plus
would require, that a *is* already an expression, but
that can't be the case, because MakeExpression[] is called
to *make* the expression. A RowBox[] *can* only have strings/boxes
in it's list argument and 

MakeExpression[
RowBox[{"\[FilledCircle]", "[", b__, "]"}], StandardForm] :=
  MakeExpression[RowBox[{"{", b, "}"}], StandardForm]

will parse 

\[FilledCircle][1, 2, 3, 4]

inputs as list {1, 2, 3, 4} *and* has a pattern b__

Hers is an example

MakeExpression[
RowBox[{RowBox[{"(", a_, ")"}], "[", c___, "]"}], fmt_:StandardForm] :=
  
  MakeExpression[RowBox[{"\[FilledCircle]", "[", c, "]"}], StandardForm]

that will tranform any combination of (anything)[aSequence] to
\[FilledCircle][sequence]

Regards
  Jens

Dustin Vink wrote:
> 
> Dear Reader,
> 
> Consider the following Mathematica problem. How does one incorporate
> pattern matching conditions with the command MakeExpression?
> 
> The following does NOT work:
> 
> MakeExpression[RowBox[{a_Plus, "[", b__, "]"}], StandardForm] :=
>   MakeExpression[a, StandardForm]
> 
> Any form of condition used at the lhs seems to be ignored.


  • Prev by Date: Re: Unexpected result with RSolve?
  • Next by Date: Re: Step Info from NDSolve
  • Previous by thread: RE: MakeExpression
  • Next by thread: List, FindRoot, Bessel