Merge pull request #47 from adrianVmariano/master

Use each in flatten().  It's faster.
This commit is contained in:
Revar Desmera 2019-06-23 00:24:40 -07:00 committed by GitHub
commit 10f7d5118f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -541,7 +541,7 @@ function array_group(v, cnt=2, dflt=0) = [for (i = [0:cnt:len(v)-1]) [for (j = [
// l = List to flatten.
// Example:
// flatten([[1,2,3], [4,5,[6,7,8]]]) returns [1,2,3,4,5,[6,7,8]]
function flatten(l) = [for (a = l) for (b = a) b];
function flatten(l) = [for (a = l) each a];
// Internal. Not exposed.