lout-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Give parts of commands/definitions to a called command (to parse arg


From: Valery Ushakov
Subject: Re: Give parts of commands/definitions to a called command (to parse arguments)
Date: Thu, 21 Apr 2016 00:10:15 +0300
User-agent: Mutt/1.5.24 (2015-08-30)

On Wed, Apr 20, 2016 at 19:33:38 +0200, Oliver Bandel wrote:

> def vvec
>   right body
>   { pmatrix strut { Yes }  body }
> 
> The body is nor parsed again, so it is not seen as command, when using
> 
>     vvec { row col a row col b row col c }
> 
> inside @Eq.
[...]
> Or are there other ways to achieve my goal?

Just use a macro.  "pmatrix" itself is a macro that supplies some
additional paramters to "matrix".

    import @Math macro vvec { pmatrix strut { Yes } }


PS:

> Is there a way to parse the body inside the vvec-command?

Ugm, ... jein...  Using extend or import on a named paramter, like in my
previous example with "int".  But the problem is that the body will be
evaluated in the wrong environment.

E.g. 

    # XXX: bad
    extend @Math
    def vvec
        # make row/col of matrix work here
        import matrix named @ {}
    {
        # but this environmen doesn't affect "@"
        pmatrix strut { Yes } { @ }
    }

but then "@" is evaluated in a context where paramters to the "matrix"
are defaults, so

    @Math { VA @{ row col a row col b row col c } }

will not have struts.

I think this is what Exepert's Guide refers to in passing when it says
that in this case the symbols imported from may not have parameters.
Jeff can probably provide more details about this.

-uwe



reply via email to

[Prev in Thread] Current Thread [Next in Thread]