diff --git a/alternative.hs b/alternative.hs new file mode 100644 index 0000000..94b2813 --- /dev/null +++ b/alternative.hs @@ -0,0 +1,8 @@ +combinations :: Int -> [a] -> [[a]] +combinations 0 _ = [[]] +combinations n xs = [ xs !! i : x | i <- [0..(length xs)-1] + , x <- combinations (n-1) (drop (i+1) xs) ] + +capture :: Ord => [a] -> [b] -> Int +capture xs ys = length [x | x<-cs, elem x ys] +