3 ms·
>The perl example cited here kind of blows my mind compare to the trivial python approach That's because the Perl version is a two-for-one deal: just for fun,
by Qcombinator 10y ago
>The perl example cited here kind of blows my mind compare to the trivial python approach
That's because the Perl version is a two-for-one deal: just for fun, Cestith threw in a non-recursive version too. The 'trivial' recursive approach is more or less equivalent to the Python:
sub flatten { map ref($_)? flatten(@$_) : $_, @_ }