lua-users home
lua-l archive

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

On Sun, Oct 31, 2010 at 6:39 PM, Johnson Lin <> wrote:
> There's still some possibility to write simply lazy( x(x) ) without
> the real function being evaluated,

That's precisely one of the goodies that Geoff has in Rima.

I came up with a similar thing when working on functional idioms for
Penlight, inspired by the Boost::lambda library.

It does work, yes, and the result is efficient because these
expressions are compiled into Lua bytecode (via their string
representation).  Although it's not so easy to cache the result as
with string lambdas. (The cool thing about this representation is that
symbolic algebra becomes possible and in fact pretty straightforward.)

I remain in mourning about the fact that |x| x*(x+1) will never be
found in mainline Lua, but gotta move on... with the token-filter
patch, the form \x(x*(x+1)) is easy to implement, but I rather doubt
as well that any form of the token-filter patch will become canonical

steve d.