Haskell Array Maximal Adjacement Difference
arrayMaximalAdjacentDifference :: [Int] -> Int
arrayMaximalAdjacentDifference a
| length a < 3 = 0
| otherwise = maximum (zipWith3 middle a (tail a) (drop 2 a))
where
middle p c n = max (abs (c - p)) (abs (c - n))
This checks the gap between each pair of neighbors and returns the largest difference.