RosettaCodeData/Task/Balanced-brackets/Haskell/balanced-brackets-1.hs

7 lines
170 B
Haskell
Raw Permalink Normal View History

2023-07-01 11:58:00 -04:00
isMatching :: String -> Bool
isMatching = null . foldl aut []
where
aut ('[':s) ']' = s
-- aut ('{':s) '}' = s -- automaton could be extended
aut s x = x:s