Skip to content

Instantly share code, notes, and snippets.

Embed
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]
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment