P07 - 将嵌套数组结构扁平化。
作者:Eric Hodges
规范
P07 (**) Flatten a nested array structure. Transform an array, possibly holding arrays as elements into a `flat' list by replacing each array with its elements (recursively).
示例
> splat([1,[2,[3,4],5]]).perl.say; (1, 2, 3, 4, 5)
源代码: P07-eric256.pl
use v6; sub splat (@t) { return (gather @t.deepmap(*.take)).list; } splat(['a', ['b',['c','d'], 'e']]).perl.say;