You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The contract of Iterable[A] does not prescribe an order for the elements; thus methods take Seq[A] parameters to document this fact --- and not especially to prescribe fast linear/indexed access.
As debox.Buffer has its elements ordered, a toSeq array wrapper would be a great addition. Right now, collection.mutable.WrappedArray cannot be used because the underlying debox.Buffer.elems array could be longer than the buffer itself.
Thus I propose to create an ArrayView class implementing Seq, with private fields array, offset and length and a few methods overridden for speed: I'm thinking of head, tail, apply, foreach, iterator, drop, take. The implementation trait for the other methods would have to be carefully chosen from the Scala collections to use linear access.
I can try a proof of concept PR: any interest ?
The text was updated successfully, but these errors were encountered:
So, there are issues with mixing specialization and Seq[A]. Feel free to give it a shot -- we might need to extensively modify you code to try to get it to work with specialization properly. In any case, having a .toSeq conversion seems useful.
The contract of
Iterable[A]
does not prescribe an order for the elements; thus methods takeSeq[A]
parameters to document this fact --- and not especially to prescribe fast linear/indexed access.As
debox.Buffer
has its elements ordered, atoSeq
array wrapper would be a great addition. Right now,collection.mutable.WrappedArray
cannot be used because the underlyingdebox.Buffer.elems
array could be longer than the buffer itself.Thus I propose to create an
ArrayView
class implementingSeq
, with private fieldsarray
,offset
andlength
and a few methods overridden for speed: I'm thinking ofhead
,tail
,apply
,foreach
,iterator
,drop
,take
. The implementation trait for the other methods would have to be carefully chosen from the Scala collections to use linear access.I can try a proof of concept PR: any interest ?
The text was updated successfully, but these errors were encountered: