Created
April 23, 2015 02:42
-
-
Save m-alvarez/9b81383e15633c542582 to your computer and use it in GitHub Desktop.
Checking for balanced parentheses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
validParentheses = (== 1) . foldl (flip ($)) 1 . map (\case { '(' -> (* 2); ')' -> (`div` 2) }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment