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
- References:
- Add syntax highlighting to own command
- From: earthnut@web.de (Bastian Erdnuess)
- Add syntax highlighting to own command