[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: [ANN] Penlight Libraries, First release
- From: steve donovan <steve.j.donovan@...>
- Date: Wed, 29 Apr 2009 16:04:11 +0200
Hi guys,
A number of substantial changes since the last beta.
The map and reduce functions now take the function first, as Nature intended.
The Python-like overloading of '*' for strings has been dropped, since it
is silly. Also, strings are no longer callable; use 's:at(1)' instead of
's(1)' - this tended to cause Obscure Error messages.
Wherever a function argument is expected, you can use the operator strings
like '+','==',etc as well as pl.operator.add, pl.operator.eq, etc.
(see end of pl/operator.lua for the full list.) So you can say:
reduce('+',tbl)
tablex now has compare() and compare_no_order(). An explicit set()
function has been added which constructs a table with the specified
keys, all set to a value of true.
List has reduce() and partition() (This is a cool function which
separates out elements of a list depending on a classifier function.)
There is a new array module which generalizes tablex operations like
map and reduce for two-dimensional arrays. An iterator is provided
that behaves like a generalized ipairs:
for i,j,v in array.iter(A,true) do print(i,j,v) end
(It complements but does not aim to provide matrix operations)
The famous iterator over permutations from PiL 9.3 has been included;
I needed it for array.product, which does a cartesian product of two lists.
David's list comprehension library has been included.
Also, utils now contains his memoize function, plus a useful function
args which captures the case where varargs contains nils.
There was a bug with dir.copyfile where the flag was the wrong way round.
config.lines() had a problem with continued lines.
Some operators were missing in pl.operator; have renamed them to be
consistent with the Lua metamethod names.
There is no doubt a fair amount of redundant and tautologous functionality,
but the winners will improve and the losers will be weeded out.
No cows are sacred at this stage; please try to break.
Any suggestions are welcome.
http://penlight.luaforge.net/penlight.html
http://luaforge.net/frs/download.php/4051/pl.0.6.3.zip
steve d.