Join Slack
Communities
Powered by
Is drop/skip the same as a seek (like in a file) i...
# stdlib
a
asad.awadia
06/01/2022, 12:49 AM
Is drop/skip the same as a seek (like in a file) in a sequence? Any way to support seeking to a particularl location instead of doing a noop loop
i
ilya.gorbunov
06/01/2022, 1:00 AM
In general, no. Sequences are forward-only and sequential.
ilya.gorbunov
06/01/2022, 1:01 AM
Theoretically, you could create a wrapper, but it would have to memoize the source sequence entirely to support random access seek.
a
asad.awadia
06/01/2022, 1:02 AM
Right, at which point might as well just use an array/list
z
Zac Sweers
06/01/2022, 1:28 AM
There is a MemoizedSequence impl in the KSP plugin if you're interested. There's benefits to lazy eval
a
asad.awadia
06/01/2022, 1:41 AM
Will check that out thx
7
Views
Open in Slack
Next