Is there any way to reference other elements with Ruby's #map and #select? : I have an array of numbers, with I'd like to compare with its neighbours:

    a = [1, 2, 3, 90, 4, 5, 6 ..., 10]
    
I'd like to remove any "too much different" items (ex.: 90).

Is there a "map / select with index", by which I could reference previous/next items ?

    a.select { |i| i.too_much_different? i.prev, i.next }