diff --git a/strings/README.md b/strings/README.md index 39e1a7ac..7101b987 100644 --- a/strings/README.md +++ b/strings/README.md @@ -34,5 +34,6 @@ ### Haskell -1. [Palin Check](haskell/palindrome.hs) +1. [Palindrome Check](haskell/palindrome.hs) +2. [All subsequences](haskell/sequence.hs) diff --git a/strings/haskell/sequence.hs b/strings/haskell/sequence.hs new file mode 100644 index 00000000..f7232d96 --- /dev/null +++ b/strings/haskell/sequence.hs @@ -0,0 +1,8 @@ +-- program to generate all subsequences of a sequence + +import Control.Monad (filterM) + +findSubSequences :: String -> [String] +findSubSequences = filterM $ const [True, False] + +main = traverse print $ findSubSequences "abc"