-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
beginof(a) analogue to endof(a)? #23354
Comments
Re #15750 |
Since the consensus in #15750 was for a |
|
@ararslan, We can implement the function before we implement any syntactic sugar for it, but we should still name it consistently with the planned sugar. |
What about changing both to |
Or |
Rename endof->lastindex and introduce firstindex. Fixes #23354
Looping over
1:length(a)
is wrong forAbstractVector
because it fails for non 1-based arrays.eachindex(a)
is correct, but occasionally you need to provide explicit indices, e.g. to loop only over odd indices as in #23267.start(a):endof(a)
doesn't work because for viewsstart(a)
is a tuple. You can dofirst(eachindex(a))
, but this is kind of klunky and non-obvious.Can we export a function
startof
beginof(a) = first(eachindex(a))
analogous toendof(a)
?The text was updated successfully, but these errors were encountered: