Created
May 19, 2016 20:46
-
-
Save ivirshup/e9148f01663278ca4972d8a2d9715f72 to your computer and use it in GitHub Desktop.
Function to completely flatten nested arrays in julia. Surprisingly efficient.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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