Version history
Unreleased
Additions
- Added
mapi (t, f)in table functions.
Fixes and improvements
- Fixed
chunkto avoid generating chunks at index 0. - Made argument
ftochunkoptional. Defaults toidentity - Fixed alias to
uniqueId - Fixed
M.powerset - Prevents straight calls to io and os modules for Redis compatibility
2.1.0 (09/12/2018)
Breaking changes
- Renamed
toArraytopack - Renamed
reducebytoreduceBy - Removed
skipas alias tolast - Changed prototype :
each(t, f, ...)is noweach(t, f) - Changed prototype :
eachi(t, f, ...)is noweachi(t, f) - Changed prototype :
adjust(t, key, f, ...)is nowadjust(t, key, f) - Changed prototype :
countf(t, f, ...)is nowcountf(t, f) - Changed prototype :
map(t, f, ...)is nowmap(t, f) - Changed prototype :
reduceBy(t, f, pred, state, ...)is nowreduceBy(t, f, pred, state) - Changed prototype :
select(t, f, ...)is nowselect(t, f) - Changed prototype :
reject(t, f, ...)is nowreject(t, f) - Changed prototype :
all(t, f, ...)is nowall(t, f) - Changed prototype :
invoke(t, method, ...)is nowinvoke(t, method) - Changed prototype :
min(t, transform, ...)is nowmin(t, transform) - Changed prototype :
max(t, transform, ...)is nowmax(t, transform) - Changed prototype :
countBy(t, iter, ...)is nowcountBy(t, iter) - Changed prototype :
groupBy(t, iter, ...)is nowgroupBy(t, iter) - Changed prototype :
selectWhile(array, f, ...)is nowselectWhile(array, f) - Changed prototype :
dropWhile(array, f, ...)is nowdropWhile(array, f) - Changed prototype :
findIndex(array, pred, ...)is nowfindIndex(array, pred) - Changed prototype :
findLastIndex(array, pred, ...)is nowfindLastIndex(array, pred) - Changed prototype :
chunk(array, f, ...)is nowchunk(array, f) - Changed prototype :
times(iter, n, ...)is nowtimes(iter, n) - Changed prototype :
template(id, ...)is nowtemplate(id) - Changed prototype :
tap(obj, f, ...)is nowtap(obj, f) - Changed prototype :
result(obj, method, ...)is nowresult(obj, method) - Changed prototype :
intersection(array, ...)is nowintersection(array)
Other changes
- Renamed
arraytotabulate, with no alias - Moved
invertto object functions
Additions
- Added
bestin table functions - Added
allEqualin table functions - Added
sortedkiterator in array functions - Added
sortedviterator in array functions - Added
disjointin array functions - Added
nsortedin array functions - Added
duplicatesin array functions - Added
xpairsin array functions - Added
xpairsRightin array functions - Added
callin utility functions - Added
typein object functions - Added
spreadPathin object functions - Added
flattenPathin object functions - Added
threadin utility functions - Added
threadRightin utility functions - Added
iterlenin utility functions - Added
skipin utility functions - Added
bothin utility functions - Added
eitherin utility functions - Added
neitherin utility functions - Added
dispatchin utility functions - Added
noargin utility functions
2.0.0 (08/23/2018)
Breaking changes
- library functions now accept iterators prototyped as
f(v, k, ...)instead off(k, v, ...). It improves the benefits of chaning and helps writting a clear functional-style code. Library functions affected with this breaking change are :each,eachi,countf,map,reduceby,select,reject,all,groupBy,countBy,selectWhile,dropWhile,findIndex,findLastIndex,chunk. reducebyis now prototyped asreduceby(t, f, pred, state)instead ofreduceby(t, f, state, pred).timesis now prototyped astimes(iter, n, ...)instead oftimes(iter, n, ...).bindAllwas renamed tobindallfunctionsno longer accept optionalsortthird argumentsslidingwas renamed tooverlapping- Improved
rangeto handle negative progressions and start the count from 1. memoizeno longer takes ahashfunction.
Other changes
- Made
shifta default library function, andpopits alias. - Moved
shufflefrom table function to array functions - Made
iteratorto accept an extra optional argn
Additions
Added support for operators
- Arithmetic operators :
add,sub,mul,div,mod,exp,pow(alias toexp),unm,neg(alias tounm),floordiv,intdiv - Relational operators :
eq,neq,lt,gt,le,ge - Logical operators :
land,lor,lnot - Concatenation operator :
concat - Length operator :
length,len(alias tolength)
Added functions
- Added
adjustin table functions - Added
xprodin array functions - Added
prependin array functions - Added
zerosin array functions - Added
onesin array functions - Added
vectorin array functions - Added
aperturein array functions - Added
sumin array functions - Added
productin array functions - Added
meanin array functions - Added
medianin array functions - Added
powersetin array functions - Added
zipWithin array functions - Added
pairwisein array functions - Added
applySpecin utility functions - Added
nthArgin utility functions - Added
condin utility functions - Added
castArrayin utility functions - Added
unaryin utility functions - Added
aryin utility functions - Added
reargin utility functions - Added
unfoldin utility functions - Added
convergein utility functions - Added
pathin object functions
Added function aliases
- Added
updateas alias toadjust - Added
alwaysas alias toconstant - Added
intersperseas alias tointerpose - Added
slidingas alias toaperture - Added
tabulateas alias toarray - Added
matchesas alias toisEqual - Added
averageas alias tomean - Added
nAryas alias toary - Added
transposeWithas alias tozipWith
1.6.1 (04/27/17)
- Added
_.array - Added
_.clear - Added
_.time - Added
_.before
1.6.0 (14/04/17)
- Added
_.toObj - Added
_.noop - Added
_.partialRight - Added
_.flip - Added
_.overArgs - Added
_.over - Added
_.overEvery - Added
_.overSome
1.5.1 (04/13/17)
- Added
_.curry - Added
_.fill - Added
.transposeas an alias to_.zip
1.5.0 (04/10/17)
Additions
-
Added
_.bind2 -
Added
_.reduceby -
Added
_.iterator(and alias_.iter) -
Added
_.sliding -
Added
_.sample -
Added
_.sampleProb -
Added
_.where -
Added
_.sortBy -
Added
_.findIndex -
Added
_.findLastIndex -
Added
_.bindAll -
Added
_.partial -
Added
_.kvpairs -
Added
_.property -
Added
_.propertyOf -
Added
_.constant -
Added parameter
padto_.partition
Changes, bugfixes
- Improved
_.select - Fixed
_.compose - Made
_.containsas an alias to_.include - Improved
_.all - Fixed
_.size - Improved
_.mapto map key-value pairs to key-value pairs - Fixed
_.partitionto generate an error for partition size < 1.
1.4.0 (07/14/14)
Breaking
Changes
- Aliases are available by default
_.findis no longer an alias to_.detect- Provided a new implementation of
_.unique, removed argument_.isSorted _.isNilnow returns true if arg is nil, an empty string or empty table and false otherwise._.sizenow returns 0 for empty args instead ofnil_.uniqueno longer acceptsiterargument to transform original array values._.cycleargumentnnow defaults to 1._.groupByno longer handlesiteras a string
Renamed
- Renamed alias
_.uIdto_.uid - Renamed
_.addto_.addTop - Renamed
_.uniqas alias to_.unique - Renamed
_.symmetric_differenceto_.symmetricDifference
Removed
- Removed
_.paired
Improvements & bugfixes
_.reducenow supports an array of booleans_.picknow picks false values_.concatargsiandjdefaults explicitely to 1 and array length (for compatibility with LuaJIT)_.popnow takes an optional extra-arg n, to be the number of values to be popped_.unshiftnow takes an optional extra-arg n, to be the number of values to be retrieved- Moved explicitely
_.toArrayto array functions _.functionsaccepts an extra-arg to prevent from looking-up for methods in metatables.
New functions (and aliases)
- Added
_.find - Added
_.pipe - Added
_.complement - Added
_.juxtaposeand alias_.juxt - Added
_.isuniqueand alias_.isuniq - Added
_.rep - Added
_.interleave - Added
_.interpose - Added
_.partitionand alias_.part - Added
_.permutationand alias_.perm - Added
_.compareas alias to_.isEqual - Added
_.isIterable - Added
_.toBoolean - Added
_.pulland alias_.remove - Added
_.at
New aliases
- Added
_.xoras alias to_.symmetricDifference
1.3.2.1 (04/22/13)
Renamed global MOSES_NO_ALIASES to global MOSES_ALIASES. Aliases are not available by default.
1.3.2 (04/19/13)
Added _.import, export library to context or _G
Added noConflict option to _.import
Added MOSES_NO_ALIASES option when requiring the library
Added _.symmetric_difference
Added _.eachi
Added _.isInteger
Added _.cycle
Added _.count
Added _.countf
Added _.chunk (inspired from Ruby's Enumerable #chunk)
Added _.chop as alias to _.removeRange
Added _.skip as alias to _.last
Added _.diff as alias to _.difference
Added _.symdiff as alias to _.symmetric_difference
Added _.forEachi as alias to _.eachi
Added _.loop as alias to _.cycle
Renamed _.pairs to _.paired
Removed _.count as alias to _.range
Changed _.difference behaviour, now takes up to two arrays as args
Fixed internal inconsistencies with aliases, should not be used internally with regards to MOSES_NO_ALIASES option.
Fixed _.each implementation, should not return anything
1.3.1 (04/12/13)
- Added chaining interface
- Renamed
_.isObjectto_.isTable - Added
_.tap,_.chain,_()and_.value - Added
_.findWhere - Added
_.contains - _.functions no longer takes an output table
- Changed _.isArray behaviour, returns true only for real Lua arrays
- Updated specs
- Updated docs and samples
1.3.0 (11/12/12)
- Removed _.iterate (slower than pairs, ipairs)
- Added _.identity
- Removed _.curry (was more like a closure, will provide a proper implementation later)
- Removed _.iter_to_array
- Most of all functions rewritten
- .import/.mixin now imports library functions to the global env.
- Added type checking functions as object functions
- Added new functions and aliases : Moses has 85 unique functions, 117 counting aliases.
- Added HTML docs
- Added Specs
- Added samples
1.2.1 (08/20/12)
- Added
_.takeWhile(as alias to_.selectWhile) - Added
_.dropWhileand_.rejectWhile(as alias) - Updated Moses_Lib_Test.lua
- Updated documentation
1.2 (08/19/12)
- Added
_.selectWhile - Added
_.mapReduceand_.mapr(as alias) - Added
_.mapReduceRightand_.maprr(as alias) - Added
_.bindn - Added
_.appendLists - Updated Moses_Lib_Test.lua
- Updated documentation
1.1 (08/04/12)
- Removed
_.containsas alias to_.include - Added
_.removeRange(as Array function) - Added
_.sameKeysand_.contains(as Collection functions) - Added
_.bind(as Utility function) - Updated Moses_Lib_Test.lua
- Updated documentation
1.0 (08/02/12)
- Added
_.append,_.invert,_.import,_.template,_.curry - Updated Moses_Lib_Test.lua
- Updated documentation
0.1 (07/24/12)
- Initial Release