Y
Hacker News
new
|
ask
|
show
|
jobs
by
contravariant
2520 days ago
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; }
1 comments
masklinn
2520 days ago
You could also blow up your stack as there is no requirement whatsoever that javascript implementations be tail-recursive.
link