Skip to content

Instantly share code, notes, and snippets.

@anthonyclays
Created September 11, 2015 15:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anthonyclays/802da7fdb17f4db6d718 to your computer and use it in GitHub Desktop.
Save anthonyclays/802da7fdb17f4db6d718 to your computer and use it in GitHub Desktop.
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