Skip to content

Commit

Permalink
nice way
Browse files Browse the repository at this point in the history
  • Loading branch information
skididdles committed Oct 7, 2014
1 parent 0908e5a commit 9ca6c2d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions alternative.hs
Original file line number Diff line number Diff line change
@@ -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]

0 comments on commit 9ca6c2d

Please sign in to comment.