Skip to content

Instantly share code, notes, and snippets.

@sw17ch
Created February 28, 2014 17:36
Show Gist options
  • Select an option

  • Save sw17ch/9275660 to your computer and use it in GitHub Desktop.

Select an option

Save sw17ch/9275660 to your computer and use it in GitHub Desktop.
sequences :: [a] -> [[a]]
sequences ls = ls' ++ [i ++ [a] | i <- sequences ls, a <- ls]
where
ls' = map (:[]) ls
main :: IO ()
main = do
let syms = ["a","e","i","o","u","y"]
mapM_ (print . concat) (sequences syms)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment