We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c618817 commit 4f7c12eCopy full SHA for 4f7c12e
ch11/AsPatterns.hs
@@ -3,10 +3,11 @@ module AsPatterns where
3
import Data.Char (toUpper)
4
5
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
6
-isSubsequenceOf [] _ = True
7
-isSubsequenceOf _ [] = False
8
-isSubsequenceOf s@(x:xs) (y:ys) =
9
- (x == y && isSubsequenceOf xs ys) || isSubsequenceOf s ys
+isSubsequenceOf s t = go s t
+ where
+ go [] _ = True
+ go _ [] = False
10
+ go (a:as) (b:bs) = (a == b && go as bs) || go s bs
11
12
capitalizeWords :: String -> [(String, String)]
13
capitalizeWords = go . words
0 commit comments