Split an Array into Segments
23 September 2020
Updated: 03 September 2023
It can sometimes be useful to split an array into a separated set of rows or columns, such as when trying to separate elements into buckets while maintaing order.
For example, given the following input
:
With the desired output
array as follows, in which we split elements into different rows, while maintaing a top-down/left-right ordering:
We can accomplish this using a function like so:
Which can then be used with: