Skip to content

Instantly share code, notes, and snippets.

@jhigdon
Created October 10, 2016 20:37
Show Gist options
  • Save jhigdon/700868a6dd5cd736f47a85bd046aee41 to your computer and use it in GitHub Desktop.
Save jhigdon/700868a6dd5cd736f47a85bd046aee41 to your computer and use it in GitHub Desktop.
thing l = map (\x -> if (count x lower) > 1 then ')' else '(' ) lower
where lower = map toLower l
count n = length . filter (==n)
-- λ: thing "SucCess" == ")())())"
-- True
-- λ: thing "din" == "((("
-- True
-- λ: thing "recede" == "()()()"
-- True
-- λ: thing "SucCess" == ")())())"
-- True
-- λ: thing "(( @" == "))(("
-- True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment