Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Vector partitioning into n chunks
chunks(l::AbstractVector, n::Int) = let part_l = length(l) / n
[let start = floor(Int, (i-1)*part_l + 1), stop = floor(Int, i*part_l);
l[start:stop] end for i in 1:n]