I just noticed that xs[length(xs)+1+n:end] returns an empty vector instead of throwing a bounds error. I think this is brilliant!
When was this behavior introduced? I don’t think I’ve seen this behavior in other languages. I’m curious if there was a discussion around this? Maybe a PR?
AFAIK, it’s always been that way. length(xs)+1+n:end is just syntax for length(xs)+1+n:lastindex(xs), and ranges that end before they start are empty, so the getindex function returns immediately.