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 @@ -1879,11 +1879,25 @@ isInfixOf needle haystack
18791879 | otherwise = not . L. null . indices needle $ haystack
18801880{-# INLINE [1] isInfixOf #-}
18811881
1882- -- | The 'isSubsequenceOf' function takes two 'Text's and returns
1883- -- 'True' iff the second is a subsequence of the first.
1884- -- (characters of the second argument appear in same sequential order in
1885- -- the first, to say if second argument can be derived by deleting some
1886- -- or no elements from the first).
1882+ -- 2021-09-29: NOTE:
1883+ -- * after the implementation - determine & mention the big O
1884+ -- | The 'isSubsequenceOf' function takes the main text and the subsequnce
1885+ -- to find and returns 'True' iff the second argument is a subsequence
1886+ -- of the first.
1887+ --
1888+ -- "Subsequence" used in the meaning of: characters of the second argument
1889+ -- appear in same sequential order in the main data, to say second argument can
1890+ -- be derived by deleting some (any) or no elements from the first.
1891+ --
1892+ -- Examples:
1893+ --
1894+ -- >>> isSubsequenceOf "1234567" "1356"
1895+ -- True
1896+ --
1897+ -- >>> isSubsequenceOf "1234567" "21"
1898+ -- False
1899+ --
1900+ -- `isSubsequenceOf` is the base case & implementation of fuzzy search.
18871901isSubsequenceOf :: Text -> Text -> Bool
18881902isSubsequenceOf tf sf
18891903 | length sf > length tf = False
You can’t perform that action at this time.
0 commit comments