Commit Graph

39 Commits

Author SHA1 Message Date
Max Cahill
bde95f208f added functional.map_pairs 2024-09-20 15:38:52 +10:00
Max Cahill
3d03d3238a renamed functional.zip to functional.combine; functional.zip and new functional.unzip are now "more traditional" simple sequence operations 2024-01-11 12:08:22 +11:00
Max Cahill
4a93f41807 added functional.count_value to avoid a closure if you just want to count specific elements 2023-06-01 11:33:18 +10:00
Max Cahill
bff54f0dbd disambiguated variable names in map_call 2022-06-07 16:30:01 +10:00
Max Cahill
b68081be53 added map_call for mapping a sequence with a method call (useful for object-y collections) 2022-06-07 16:16:01 +10:00
Max Cahill
7366473f32 added functional.map_field for quick extraction of some field of a sequence of objects 2022-06-07 15:38:16 +10:00
David Briscoe
a5ebc1e501 lint: Fix shadow issues
Fix shadowing by using variables with a different name or _.

I don't think any of these warnings were actual bugs and fixed them to
maintain the same behaviour.
2022-03-03 10:17:34 -08:00
Sheepolution
f36946ace4
Add comment to foreach regarding new behaviour 2022-03-01 03:01:39 +01:00
Sheepolution
3c6aaf1a76
Return table in foreach for chaining 2022-03-01 02:03:33 +01:00
Max Cahill
aec62d92ec moved functional.splat below functional.map_inplace, reformatted a little 2022-01-25 10:22:28 +11:00
Jeremy S. Postelnek
fd998c8525
Update functional.lua 2022-01-24 16:40:46 -05:00
Jeremy S. Postelnek
a9b699afdd
Update functional.lua 2022-01-24 16:27:49 -05:00
Jeremy S. Postelnek
120c9658fc
Update functional.lua 2022-01-23 13:20:02 -05:00
Max Cahill
0eda6e8262 added functional.chain for conveniently mapping things like node paths and vector splines 2021-10-15 12:49:31 +11:00
Max Cahill
eae1849c16 fixed filter_inplace doesn't return anything, thanks sheepolution 2021-10-12 11:51:17 +11:00
chrsm
c740614cb9
functional: fix generate_2d return value 2021-08-14 20:51:45 -07:00
Max Cahill
292345b953 fixed bug in filter_inplace for single element collections 2021-07-06 14:33:41 +10:00
Max Cahill
009beadc68 Updated performance note on functional.lua 2021-06-25 13:31:33 +10:00
Max Cahill
6eb979a68c [fixed] off-by-one in functional.cycle 2021-04-12 16:13:46 +10:00
Max Cahill
4f380d8afe [added] functional.stitch and functional.cycle specialised mapping variants 2021-04-12 13:04:08 +10:00
Max Cahill
b45f606cdf [fixed] regressions in functional.lua 2020-11-12 13:50:30 +11:00
Max Cahill
a810bf4ce5 [modified] unnecessary use of cached table length for many functions 2020-11-11 13:38:52 +11:00
Max Cahill
715765003d [modified] moderate functional refactor (BREAKING)
- modified functional.reduce signature; takes seed value before function now as this results in much more readable calling code
- added filter_inplace and aliased remap as map_inplace to make semantics more clear
- rewrote many functions to use numeric for as a tiny speed boost at the cost of library code readability
[modified] sequence to be compatible
2020-11-10 20:51:43 +11:00
Max Cahill
a85eec80e2 [added] "canonical" identity function 2020-06-02 15:17:50 +10:00
Max Cahill
8a62f3b19f [added] functional.generate and generate_2d 2020-05-13 21:09:15 +10:00
Max Cahill
eb428faa6e [fixed] issue in functional.zip 2020-05-13 21:08:23 +10:00
Max Cahill
e6a59460bd [modified] functional.remove renamed to functional.remove_if, moved functional.group_by, more documentation added 2020-05-12 09:42:06 +10:00
Jack Robinson
2d24d8e913 [added] add remove which holds onto all elements where f(v) returns false 2020-05-11 21:31:43 +12:00
Jack Robinson
d882127bda [added] add group-by function to group elements by the return of a provided function 2020-05-11 21:31:43 +12:00
Max Cahill
a87380f43c [modified] moved dedupe from functional to tablex 2020-04-08 21:18:52 +10:00
Max Cahill
8d5da0a9ff [modified] moved append and append_inplace from functional to tablex 2020-04-08 20:50:51 +10:00
Max Cahill
6386aaf298 [modified] big refactor to localised modules and require("batteries"):export() for global usage; renamed files table to tablex and math to mathx to allow using the library in your module root if you really want to. 2020-04-07 13:49:10 +10:00
Max Cahill
4bbbdf86d6
[modified] functional.lua find_best changed to ipairs and added find_min and find_max better named alternatives 2020-04-04 18:59:40 +10:00
Max Cahill
3674846f11 [added] functional.find_best accepts (ignores) nil results for easy filtering 2020-03-20 22:31:20 +11:00
Max Cahill
66a9f41474 [modified] renamed to batteries, added global export suppression and more documentation 2020-03-15 20:28:50 +11:00
Max Cahill
0dd92b2c2e [moved] table.copy from functional.lua to table.lua and updated signature a little to allow deep overlays 2020-03-12 21:15:18 +11:00
Max Cahill
6e7cabe9e0 [modified] split sequence and unique_mapping to their own files
[added] async to init
2020-01-31 11:56:37 +11:00
Max Cahill
6d4fe84ac1 [modified] sequences use metatable rather than copying from table 2020-01-30 14:58:18 +11:00
Max Cahill
2f470cf7c7 initial commit 2020-01-29 14:26:28 +11:00