Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
catnaroek
on Feb 29, 2016
|
parent
|
context
|
favorite
| on:
Comparing Rust and Java
Yep, when iterators do the trick, they're preferable to indexing. But some algorithms (e.g., the tortoise and hare algorithm for cycle detection) explicitly require indexing.
llogiq
on March 2, 2016
[–]
Not necessarily – you can chain iterators and skip elements on the hare.
catnaroek
on March 2, 2016
|
parent
[–]
You're right. I was thinking exclusively of the case where you have an array whose elements themselves are indices into the same array.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: