File tree Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Expand file tree Collapse file tree 1 file changed +19
-5
lines changed Original file line number Diff line number Diff line change @@ -1883,11 +1883,25 @@ isInfixOf needle haystack
18831883 | otherwise = not . L. null . indices needle $ haystack
18841884{-# INLINE [1] isInfixOf #-}
18851885
1886- -- | The 'isSubsequenceOf' function takes two 'Text's and returns
1887- -- 'True' iff the second is a subsequence of the first.
1888- -- (characters of the second argument appear in same sequential order in
1889- -- the first, to say if second argument can be derived by deleting some
1890- -- or no elements from the first).
1886+ -- 2021-09-29: NOTE:
1887+ -- * after the implementation - determine & mention the big O
1888+ -- | The 'isSubsequenceOf' function takes the main text and the subsequnce
1889+ -- to find and returns 'True' iff the second argument is a subsequence
1890+ -- of the first.
1891+ --
1892+ -- "Subsequence" used in the meaning of: characters of the second argument
1893+ -- appear in same sequential order in the main data, to say second argument can
1894+ -- be derived by deleting some (any) or no elements from the first.
1895+ --
1896+ -- Examples:
1897+ --
1898+ -- >>> isSubsequenceOf "1234567" "1356"
1899+ -- True
1900+ --
1901+ -- >>> isSubsequenceOf "1234567" "21"
1902+ -- False
1903+ --
1904+ -- `isSubsequenceOf` is the base case & implementation of fuzzy search.
18911905isSubsequenceOf :: Text -> Text -> Bool
18921906isSubsequenceOf tf sf
18931907 | length sf > length tf = False
You can’t perform that action at this time.
0 commit comments