Flux.chunk error?

Here is some code:

chunk[1:20,6)

which returns:

 [1, 2, 3, 4]    
 [5, 6, 7, 8]    
 [9, 10, 11, 12] 
 [13, 14, 15, 16]
 [17, 18, 19, 20]

That is only 5 chunks, and I expect 6. Why not return

[1,2,3,4]
[6,7,8,9]
[11,12,13,14]
[16,17,18,19]
[]

The documentation states: returns “n” chunks, but there are no caveats given.

I think this may be a bug. You may want to report an issue, and possibly provide a PR fixing this (it’s a trivial utility function so this should be easy).

What would you expect chunk(4,3) to return? There are multiple approaches.
If 8 chunks are expected, the answer should be [1],[2],[3,4]. However, the last chunk is then larger than the others. I do not Know whether that is expected behavior or not. It is the difference between using floor and ceiling in the definition of the chunk() function.