Consider the following:
Let's say we have an array of integers of an arbitrary length L.
[a,b,c,...,z]
I know we can easily split this array and create multiple arrays of length n: [a,b], [c,d],..., [y,z]
How would we split this array and return something such as
[a,b,c]
, [b,c,d]
, [c,d,e]
, ..., [w,x,y]
, [x,y,z]
?
Essentially, if given an array can we create new arrays from that array using any function of our choosing? Does the type of function affect how we do this? How fancy can we get?
Most of what I've found involves slicing an array first and then performing operations on the new arrays. I'd like to create my arrays based on a function of my choosing.