Re: Add syntax highlighting to own command
- To: mathgroup at smc.vnet.net
- Subject: [mg101783] Re: Add syntax highlighting to own command
- From: Daniel <janzon at gmail.com>
- Date: Fri, 17 Jul 2009 05:02:13 -0400 (EDT)
- References: <200907090600.CAA17547@smc.vnet.net> <h3766u$f9h$1@smc.vnet.net>
Hi Bastian,
I think the line
> Let[ { head_ }, expr_ ] := With[ { head }, expr ]
is unnecessary since tail_ can match the empty sequence in
> Let[ { head_, tail__ }, expr_ ] :=
> With[ { head }, Let[ { tail }, expr ] ]
Or did I miss something?
All the best,
Daniel
On 16 Juli, 14:19, earth... at web.de (Bastian Erdnuess) wrote:
> Bastian Erdnuess <earth... 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