I have a ruby array of, say, 10 elements, and I'd like to return all but the 5th element.
a = *(1..10) I'd like to be able to do something like
a[0..3 + 5..9] Or even better something like (borrowing from the R syntax),
a[-4] to do this, but that doesn't work. (Nor does anything more clever I've tried like getting an array of the element indices). What's the best way to do this in ruby?
a[0..3] + a[5..9]?(1..10).reject { |element| element == 5 })