[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: OT(slightly): parser generator for expression with custom operators
- From: Luis Carvalho <lexcarvalho@...>
- Date: Wed, 29 Jun 2011 12:43:43 -0400
> > For example, consider math vectors:
> > W = V1 :x: V2 + V3
> > W = V1:cross_product(V2) + V3 -- less readable
> OK, good one. But you could overload ^ for that, and * for dot
> product. (And % is also available)
As an aside, in Numlua I'm defining % for matrix multiplication and * for
elementwise matrix multiplication (/ and ^ keep their elementwise
> True, :x: is cute. To answer your question, one thing that LuaMacro
> can not do is parse infix expressions. You could define ':x:' as a
> lexical token and replace it by '%', that kind of thing. But for such
> a simple step, gsub is your friend ;)
It'd be nice to have a` for a:transpose(), so I'll take a look at LuaMacro
but only *after* I finish Numlua (hopefully by the end of the summer :))...
Computers are useless. They can only give you answers.
-- Pablo Picasso
Luis Carvalho (Kozure)
lua -e 'print((("lexcarvalho@NO.gmail.SPAM.com"):gsub("(%u+%.)","")))'