Underscore Lua is a lib I have been using for quite a while. http://mirven.github.io/underscore.lua/
Lua Fun: A high-performance functional programming library designed for LuaJIT
21–30 of 34 posts
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#22Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#23In case you skipped the article it contains this nugget: Take this example containing functional composition and higher-order functions: reduce(operator.add, 0, map(function(x) return x^2 end, range(n))) LUA converts this into 10 lines of assembler (2 jumps). Also, the LUA compiler is directly generating SSE. Anyone have any good benchmarks comparing simple functional examples in LUA with Clojure or Common Lisp?
I know nothing about LUA syntax, so I also have no idea which part of this is new and which part is ordinary LUA. Is -- calculate sum(x for x^2 in 1..n) a comment or is it the output of a code transform?
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#24Underscore Lua is a lib I have been using for quite a while. http://mirven.github.io/underscore.lua/
Looks cool, but hasn't been updated in four years.
Two more up-to-date forks can be found here....
- https://github.com/jtarchie/underscore-lua
- https://github.com/mark-otaris/underscore.lua
NB. The jtarchie fork seems best because its got 59 stars & 5 contributors.
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#25it would be nice to have this or underscore library inside redis
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#26In case you skipped the article it contains this nugget: Take this example containing functional composition and higher-order functions: reduce(operator.add, 0, map(function(x) return x^2 end, range(n))) LUA converts this into 10 lines of assembler (2 jumps). Also, the LUA compiler is directly generating SSE. Anyone have any good benchmarks comparing simple functional examples in LUA with Clojure or Common Lisp?
I know nothing about LUA syntax, so I also have no idea which part of this is new and which part is ordinary LUA. Is -- calculate sum(x for x^2 in 1..n) a comment or is it the output of a code transform?
The point is not about expressiveness; it's that while this code composes several higher-order functions, it's compiled into the kind of assembly code you'd expect from a fully optimized C routine.
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#27Earlier quoted context omitted.
> Even though we occassionally talk about Lua on HN, it frankly still doesn't get enough attention - nor does Mike Pall and his fantastic work on LuaJIT. Because most HNers are web developers and care only about the browser. Lua is really strong in the game developer community.
Most? I'd say far from most. I see just as many articles about Go, Scala, Clojure, etc. as I do Javascript.
All of them languages which are mostly used for web.
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#28I wish that Lua get more attention.
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#29Underscore Lua is a lib I have been using for quite a while. http://mirven.github.io/underscore.lua/
Re: Lua Fun: A high-performance functional programming library designed for LuaJIT
#30> Reference Lua may not work and is not supported Any particular reason for that?
Lua 5.1 can run fun.lua after minor changes (I'll make patch soon), but I am not sure that performance will be good enough.