[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: map/grep in Lua: Shedding My Functional Perlisms
- From: Veli-Pekka Tätilä <vtatila@...>
- Date: Mon, 11 Aug 2008 18:37:07 +0300
A good point. That's a form of memoization. Is there a memoize module for
Lua like the one in Perl? One can easily do it on demand for a particular
function by hand, of course.
> If using alpha compilers gives you the heebie jeebies, you can also do
> something like this:
> function L(args)
> return function(exp)
> return assert(loadstring("return function("..args..")"
> .." return "..exp.." end"))()
You probably want to perform some compilation caching, indexing compiled
functions with their source, so that you keep acceptable performances when
lambdas occur in loops (i.e. virtually always).
With kind regards Veli-Pekka Tätilä
Accessibility, Apps and Coding plus Synths and Music: