Instantly share code, notes, and snippets.

Embed
What would you like to do?
Function to completely flatten nested arrays in julia. Surprisingly efficient.
function flattenall(a::AbstractArray)
while any(x->typeof(x)<:AbstractArray, a)
a = collect(Base.flatten(a))
end
return a
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment