The lua-functional library.
version 1.102
for Lua 5.2.0

Bo Waggoner

Modified: 2012-02-02

This software is free.

-- No installation required. To use in your program, put 'lua-functional.lua'
-- into the current directory, then use as follows:

lfunc = dofile('lua-functional.lua')    -- load the library into 'lfunc'

lfunc.foldl(lfunc.add,0,{3,8,6,2})      -- call some functions from lfunc

lfunc.loadglobally(lfunc)               -- load library into global namespace

zipwith(sub,ipairs,{10,9,8},{5,4,3})    -- now you can call functions directly



Version          Release Date    Tested with Lua version
1.102 (current)  2012-02-02      5.2.0
1.101            2012-02-02      5.2.0
1.1              2012-02-02      5.2.0
1.001            2011-09-30      5.1.4
1.0              2011-09-29      5.1.4

1.102   -- renamed 'select' to 'choose' to avoid conflict with the built-in
           lua function
        -- renamed 'sel' to 'indicator' to correspond, and for clarity
        -- made range() a bit faster
        -- added another example: Levenshtein distance
1.101   -- slightly increased functionality of casef: predicates and results can
           now be of any type; if they are not functions, treat them as values;
           if they are functions, call them with the input arguments.
1.1     -- updated for Lua 5.2:
           -- removed 'pack' (use table.pack instead)
           -- implementation details: fixes relating to use of pack and arg
           -- updated lua-functional-test.lua for same issues
        -- increased functionality of 'casef': a result can now be true, false,
             or nil, or it may be a function of the arguments as previously
        -- increased functionality of 'range': can now be called with only
             one argument, in which case default start value is 1
1.001	fixed bug in apply where it would fail with table arguments
1.0 	first release