Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: MakeExpression problem

  • To: mathgroup at
  • Subject: [mg77110] Re: [mg77095] MakeExpression problem
  • From: "Chris Chiasson" <chris at>
  • Date: Mon, 4 Jun 2007 03:45:02 -0400 (EDT)
  • References: <>

Warning: I do not fully understand how operators are defined in
Mathematica, however I have some idea.

AFAIK, a MakeExpression rule is useless in a non-notebook environment
because the commands are (then) not represented as boxes.

You do not have to catch the DoubleLongRightArrow operator at the
"parsing" stage. Once
a==>b is read into Mathematica, it becomes the following expression (AFAIK):


You can easily define a DownValue for DoubleLongRightArrow to do what you want.

This method should work for both notebooks and package files.

On 6/3/07, Hannes Kessler <HannesKessler at> wrote:
> Hello,
> here is a small package defining and using a generic MakeExpression
> interpretation rule:
> BeginPackage["DoubleLongRightArrow`"];
> {test1,test2,a,b,interpretation};
> Begin["`Private`"];
> MakeExpression[RowBox[{x_,"\[DoubleLongRightArrow]",y_}],form_]:=
>    MakeExpression[RowBox[{"interpretation"}],form];
> test1=a\[DoubleLongRightArrow]b;
> (*The following assigment forces an interpretation by additional
> application of //ToBoxes//ToExpression*)
> test2=a\[DoubleLongRightArrow]b//ToBoxes//ToExpression;
> End[];
> EndPackage[];
> Here is a small notebook which calls the package.
> The typesetted \[DoubleLongRightArrow] looks in the notebook like ==>.
> Needs["DoubleLongRightArrow`"];
> (*The following expression is correctly interpreted in the notebook:*)
> In[] a==>b
> Out[] interpretation
> (*The expression read in the package is not interpreted:*)
> In[] test1
> Out[] a==>b
> (*Only the second expression converted first to boxes and then again
> to an expression is interpreted correctly*)
> In[] test2
> Out[] interpretation
> My question is, how can I define an interpretation rule in a package
> and use it in the same or other packages, not only in notebooks?
> Regards,
> Hannes Kessler


  • Prev by Date: Re: Re: Problem with Mathematica 6
  • Next by Date: Re: NestListEffects function not working in 6.0
  • Previous by thread: MakeExpression problem
  • Next by thread: Re: Re: MakeExpression problem