[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: |
Fri, 22 Apr 2016 04:16:11 +0300 |
User-agent: |
Mutt/1.5.24 (2015-08-30) |
On Fri, Apr 22, 2016 at 01:37:28 +0200, Oliver Bandel wrote:
> >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 } }
> [...]
>
> Thanks, that works :-)
>
> What I had first in mind was going far beyond that...
> ,,,because I wanted to have vvec working in a way, so that I only
> need to give the elements of the vector, and don't need to
> type in the "row" and "col" keywords.
> This would need to have a way to parse an argument list.
>
> It would be nice to then use only:
> vvec( 2, 3, 4, 55, 6 )
>
> and the values wil be set each on a seperate row and col.
If I got this right:
extend @Math matrix
def ","
associativity left
left x
right y
{
row col x row col y
}
and then
vvec { a, b, c }
> >>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.
> [...]
>
> I'm not familiar with all the import/extend/... stuff.
Read the Expert's Guide.
> Also ... what is just "@" as argument name?
Just a convenient short name, not really different from "foo" or
"@InitialLanguage". The at-sign doesn't have special meaning in Lout,
but since it's conventionally used as a name prefix, it makes a
natural single-letter name if you must have some special named
parameter.
-uwe