Given an array
x = [2, 3, 4, 5, 6, 7]
I'd like to slice it in half at a certain point/index and create two subarrays of such cut, but leaving out the index. Example:
x = [2, 3, 4, 6, 70, 10]
left, right = x.slice_at_index(2)
left = [2, 3]
right = [6, 70, 10]
I've tried with each_index
, slice, chunk but can't leave out the index element.