> On 23 Jul 2017, at 22:27, Sam S. via RT <perl6-bugs-follo...@perl.org> wrote: > >> Which then goes back to: what is the use case of Slipping an Array? > > Same as slipping any other type of Iterable: Fine-grained, elegant flattening > and concatenating. > > Compare: > > my @all = flat $first, @rest; > > my @all = $first, |@rest; > > When you *know* that $first is a Scalar and @rest is an Array, those two do > the same thing because `flat` doesn't descend into item containers. > > But if those are, say, function parameters, then they can become bound to > other things, e.g. the calling code could pass a List to `@rest` which > *doesn't* have its elements itemized, so the version with `flat` would > destroy the elements' internal structure. > > Even if that wasn't the case, I'd consider the `|` version more elegant than > the `flat` version, because it denotes very clearly to the reader *where* > exactly something is being flattened into the outer list. > >> because Slip is a List, it uses List.AT-POS, and that one >> doesn’t create a WHENCE with a container to be filled at a later time. > > Couldn't `@array.Slip` be made to properly iterate @array behind the scenes > (the same way that `@array.map` would iterate it), instead of reaching into > @array's guts and copying its elements in a way that misinterprets some of > them?
Which is exactly what 12d7d5b48add8347eb119 does. So fixed, and tests needed!