[SR-6991] prefix(through:) on LazyRandomAccessCollection becomes RandomAccessSlice #49539
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
standard library
Area: Standard library umbrella
Additional Detail from JIRA
md5: 3aa38e67aaf94cf70aff596c34fd4d3a
Issue Description:
invoking
prefix(through: )
onLazyRandomAccessCollection
returns aRandomAccessSlice
which makes all follow-up operations non-lazy (ie.filter
andmap
materialise an Array)...Example:
will run for a very long time. This can be fixed by an extra
.lazy
which I believe shouldn't be necessary:works. Usually, one
.lazy
works just fine such as this example:The text was updated successfully, but these errors were encountered: