lua-users home
lua-l archive

Map and filter without intermediate tables

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


Hi,
As far as I can tell, the implementations of map and filter in penlight.tablex create intermediate tables of results. Surely that's inefficient?
Now that 5.2 has __pairs (or if you write your own __pairs-aware pairs in 5.1), has anyone tried maps and filters that don't use intermediate tables? 
I did, and it was slower than using intermediate tables (and more complicated. It did save some memory though). Is it a dead-end idea, or is it that my implementation [1] is brain dead?
Cheers,
Geoff
[1] https://gist.github.com/2886368

AltStyle によって変換されたページ (->オリジナル) /