loading...

re: Daily Challenge #50 - Number Neighbor VIEW POST

FULL DISCUSSION
 

My take at the challenge written in Elm.

computeNeighbors : String -> Maybe (List Int)
computeNeighbors phoneNumber = 
  case String.toInt phoneNumber of
    Just integerPhoneNumber ->
      Just [integerPhoneNumber + 1, integerPhoneNumber - 1]
    Nothing ->
      Nothing

Try it online.

code of conduct - report abuse