Commit Graph

20 Commits

Author SHA1 Message Date
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
24913f05b8 fixed sequence:copy returning a non-sequence result 2023-08-17 11:30:20 +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
5fa80ca97c tablex: Add deep & shallow for copy, overlay
Replace copy with shallow_copy, deep_copy.
Replace overlay with shallow_overlay, deep_overlay.

Significant rewrite of these functions and their semantics to update to
the note above them.

Add corresponding tests.
2022-03-03 10:04:28 -08:00
Sheepolution
6df4b4bddd
Don't have inplace methods return a new sequence 2022-02-22 05:01:27 +01:00
Max Cahill
0be82a31df fixed sequence missing a few functional methods 2022-01-17 17:05:59 +11:00
Max Cahill
3cc177a0c0 BREAKING class interface refactor - all classes will need a minor update, see class.lua
tl;dr is that new no longer needs to call init, calling :new() directly in user code is not allowed, properties are copied, metamethods work, and a config table is needed rather than a class to extend from, so use {extends = superclass} if you want a minimal fix
2021-07-15 16:15:27 +10:00
Max Cahill
6fae516630 [added] :ipairs method for sequence, for convenient inline chaining - should consider making it the __call metamethod probably 2021-05-13 15:03:06 +10:00
Max Cahill
87834e9267 [modified] sequence wrappers a bit more; exposed functional query interface 2021-04-15 10:31:06 +10:00
Max Cahill
d476bc9c9c [modified] how sequence binds the functional interface to make binding new methods less error prone and shorter 2021-04-15 10:21:41 +10: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
7d3b568ac5 [added] correct sequence support for collapse (and flatten) 2020-07-02 17:05:26 +10:00
Max Cahill
11483c52ad [fixed] sequence regressions 2020-06-02 15:01:21 +10:00
Max Cahill
21c672989c [modified] sequence with a few fixes and newer comments since the module refactor 2020-05-14 15:28:38 +10:00
Max Cahill
e1f759cb90 [fixed] sequence:reduce typo 2020-04-07 16:19:38 +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
ad2fc71e7a [fixed] non-global compatible 2020-03-15 21:22:22 +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
6e7cabe9e0 [modified] split sequence and unique_mapping to their own files
[added] async to init
2020-01-31 11:56:37 +11:00