-- http://www.codewars.com/kata/52de553ebb55d1fca3000371
module Codewars.Kata.Arithmetic where

findMissing :: Integral n => [n] -> n
findMissing xs@(a:b:c:_)
  | b-a == c-b
    = (fst . head . filter (uncurry (/=)) . zip [a,b..]) xs
  | abs (b-a) < abs (c-b)
    = 2*b-a
  | abs (b-a) > abs (c-b)
    = 2*b-c
