bubbleSort (x:y:rest) =
  bubbleSort (init bubbled) ++ [last bubbled]
  where
    (first, second) = if x > y then (y,x) else (x,y)
    bubbled = first : bubbleSort (second:rest)
bubbleSort (x:y:rest) =
  bubbleSort (init bubbled) ++ [last bubbled]
  where
    (first, second) = if x > y then (y,x) else (x,y)
    bubbled = first : bubbleSort (second:rest)
bubbleSort (x:y:rest) =
  bubbleSort (init bubbled) ++ [last bubbled]
  where
    (first, second) = if x > y then (y,x) else (x,y)
    bubbled = first : bubbleSort (second:rest)