MathGroup Archive 2009

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

Search the Archive

Re: Add syntax highlighting to own command

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101764] Re: Add syntax highlighting to own command
  • From: earthnut at web.de (Bastian Erdnuess)
  • Date: Thu, 16 Jul 2009 08:20:26 -0400 (EDT)
  • References: <200907090600.CAA17547@smc.vnet.net> <h3766u$f9h$1@smc.vnet.net> <h3cfbl$ick$1@smc.vnet.net> <h3kd88$fqv$1@smc.vnet.net>

Bastian Erdnuess <earthnut at web.de> wrote:

> PS: Has somebody a hint how to get
> 
>   lhs := Let[ vars, expr /; cond ]
> 
> to work?

I got it:

  Let /: ( lhs_ := Let[ vars_, expr_ /; cond_ ] ) :=
    Let[ vars, lhs := expr /; cond ]

My whole Let looks now like

  SetAttributes[ Let, HoldAll ]
  SyntaxInformation[ Let ] =
    { "ArgumentsPattern" -> { _, _ } }

  Let /: ( lhs_ := Let[ vars_, expr_ /; cond_ ] ) :=
    Let[ vars, lhs := expr /; cond ]
  Let[ { }, expr_ ] := expr;
  Let[ { head_ }, expr_ ] := With[ { head }, expr ]
  Let[ { head_, tail__ }, expr_ ] :=
    With[ { head }, Let[ { tail }, expr ] ]


It looks like it doesn't matter in which order I give the rules.
Mathematica applies always the most specific.  How does it know?

Bastian


  • Prev by Date: Re: LogLinearPlot strange "features"
  • Next by Date: how to use vb.net/netlink to export a dxf file
  • Previous by thread: Re: Add syntax highlighting to own command
  • Next by thread: Re: Add syntax highlighting to own command