moduleEvenOddexposing(evenOdd)compareEvensOdds:(Int,Int)->StringcompareEvensOdds(evens,odds)=casecompareevensoddsofGT->"Even is greater than Odd"LT->"Odd is greater than Even"_->"Even and Odd are the same"evenOdd:String->StringevenOdd=String.split"">>List.map(String.toInt>>Maybe.withDefault0)>>List.partition(modBy2>>(==)0)>>Tuple.mapBothList.sumList.sum>>compareEvensOdds
Tests
moduleEvenOddTestexposing(suite)importEvenOddexposing(evenOdd)importExpectexposing(equal)importTestexposing(Test,describe,test)suite:Testsuite=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"]
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Elm
Tests