loading...

Discussion on: Daily Challenge #29 - Xs and Os

Collapse
avalander profile image
Avalander

Haskell again

import Data.Char (toLower)

compare_xos :: String -> Bool
compare_xos = same . foldl kevin (0, 0)
  where
    kevin (x, o) c
      | toLower c == 'x' = (x + 1, o)
      | toLower c == 'o' = (x, o + 1)
      | otherwise        = (x, o)
    same (x, o) = x == o
Collapse
jacobmgevans profile image
Jacob Evans

Just being able to use Haskell impresses me lol

Collapse
avalander profile image
Avalander

I can't do anything useful with it yet, but it's fun to solve coding katas :D.

Collapse
thepeoplesbourgeois profile image
Josh

dammit kevin