# Discussion on: Daily Challenge #81 - Even or Odd

Amin

Elm

``````module EvenOdd exposing (evenOdd)

compareEvensOdds : ( Int, Int ) -> String
compareEvensOdds ( evens, odds ) =
case compare evens odds of
GT ->
"Even is greater than Odd"

LT ->
"Odd is greater than Even"

_ ->
"Even and Odd are the same"

evenOdd : String -> String
evenOdd =
String.split ""
>> List.map (String.toInt >> Maybe.withDefault 0)
>> List.partition (modBy 2 >> (==) 0)
>> Tuple.mapBoth List.sum List.sum
>> compareEvensOdds
``````

Tests

``````module EvenOddTest exposing (suite)

import EvenOdd exposing (evenOdd)
import Expect exposing (equal)
import Test exposing (Test, describe, test)

suite : Test
suite =
describe "Even or odd"
[ test "Evens should be greater than odds with 12" <|
\_ ->
evenOdd "12" |> equal "Even is greater than Odd"
, test "Odds should be greater than evens with 123" <|
\_ ->
evenOdd "123" |> equal "Odd is greater than Even"
, test "Evens & odds should be equal with 112" <|
\_ ->
evenOdd "112" |> equal "Even and Odd are the same"
]
``````