Open jbclements opened 4 days ago
It's been a while since I wrote this, but the applicable code is in table-groupby
.
I think there are a couple things to note and consider:
The groups are collected and sorted by their index (see: group-indices
). This little snippet does two things:
keys
, which is the order each new key appeared in the table.key -> list of row indices
.So, the default behavior is to return each group - and the rows inside that group - to be exactly the same as they were in the source table.
However, it's also possible to supply a less-than?
sorting parameter to the function, which will sort the final list of keys generated and return each table in sorted-key order. But the order of the rows within that table should still be in original-table order.
Definitely not opposed to more tests and documentation, though. 😄
I'm wondering if the rows in the tables generated by
table-groupby
always appear in the order in which they occurred in the original table? I'm guessing the answer is yes, and I'd love to nail this down by adding a few tests and some documentation for this.