[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Possible Lua enhancements 2: Piping
- From: Mark Hamburg <mark@...>
- Date: Thu, 18 Dec 2008 17:13:42 -0800
Having said it would be easier to write in C, now I'm worrying about
how to write pipe in pure Lua...
function pipe( fn, ... )
if select( '#', ... ) == 0 then
local rest = pipe( ... )
return function( ... )
return rest( fn( ... ) )
As long as one reuses the pipe, the cost of the chain construction
probably isn't too bad.