Skip to content

Instantly share code, notes, and snippets.

@NotTheEconomist
Created June 9, 2017 23:20
Show Gist options
  • Save NotTheEconomist/5749eef9524bdb3f84c7916c3cc2e698 to your computer and use it in GitHub Desktop.
Save NotTheEconomist/5749eef9524bdb3f84c7916c3cc2e698 to your computer and use it in GitHub Desktop.
import Data.Char(toUpper, toLower)
alternateCase :: String -> String
alternateCase [] = []
alternateCase (x:[]) = [toUpper x]
alternateCase (x:y:xs) = (toUpper x):(toLower y):(alternate xs)
alternateCase "abcdefg"
-- "AbCdEfG"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment