123456789101112131415 |
- -- Slide 41
- import Data.List
- sweep::(String -> [String]) -> String -> String -> [String]
- sweep f l stack = case stack of
- [] -> [""]
- cur:substack -> concat [map (\xs -> cur:xs) (f (delete cur l)), sweep f l substack]
- ana::String -> [String]
- ana l = sweep (ana) l l
- -- Teacher version
- anac "" = [""]
- anac xs = concat (map (\c -> map (c:) (anac (delete c xs))) xs)
|