Skip to content
Better HN
Top
New
Best
Ask
Show
Jobs
Search
⌘K
undefined | Better HN
0 points
contravariant
6y ago
0 comments
Share
You
could
reproduce that behaviour of 'flat' by doing something like:
function flatten(x, n=1) { return n > 0 ? x.flatmap(y => flatten(y, n-1)) : x; }
0 comments
default
newest
oldest
masklinn
6y ago
You could also blow up your stack as there is no requirement whatsoever that javascript implementations be tail-recursive.
j
/
k
navigate · click thread line to collapse