Hello there !
I’m trying to break a list into chunks of size N .
Here’s the code which I’ve written
julia> function chunk(arr,n)
[arr[i * n:(i + 1) * n] for i in [(length(arr)+n-1)//n]]
end
Can someone make it work !
Here’s what it’s intended to do.
my_list = [1, 2, 3, 4, 5, 6, 7, 8, 9]
n = 4 //break at 4
Output: [[1, 2, 3, 4], [5, 6, 7, 8], [9]]