Functional Lua stuff

Run Settings
LanguageLua
Language Version
Run Command
function do_thing() map(fold(compose, sq, incr, incr, return_wrapper(print), incr, print, function() print("-") end), {1, 2, 3.2, 4, 5}) end function return_wrapper(f) return function(a) f(a) return a end end function fold(f, a, b, ...) if b == nil then return a end local r = f(a, b) return fold(f, r, ...) end function compose(f, g) return function(a) return g(f(a)) end end function map(f, t) local r = {} for i = 1, #t do r[i] = f(t[i]) end return r end function incr(a) return a + 1 end function sq(a) return a * a end do_thing()
Editor Settings
Theme
Key bindings
Full width
Lines