Skip to content

Commit

Permalink
reOccurances for detecting repeat teammates
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwoodbury committed Oct 8, 2014
1 parent 8013e56 commit ff06332
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions alternative.hs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,22 @@ 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)]

{-captures all groups with no two groups having students grouped more than once-}
reOccurances:: (Ord a) => [a] -> [a] -> Int
reOccurances xs ys
| length xs == 0 = 0
| length ys == 0 = 0
| otherwise = length [x|x <- xs, elem x ys]

getUnique ::

firstpos xs = [x | x <- xs, head x == 1 ]
secondpos xs = [x | x <- xs, (head (tail x)) == 2 ]

showall xs = [y | x <- xs, y <-x, y ]

each xs stu = [checkindividual y stu | y <- x,x <-xs]
--each xs stu = [checkindividual y stu | y <- x,x <-xs]

studentstruct ss = [(x,[x]) | x <- ss]

Expand Down Expand Up @@ -40,8 +50,4 @@ groupedTogether xs ys = [ y : ys | y <- xs, (not (elem y ys))]
-- | (length xs) == numbuniquegroups/8 = xs
-- |
--capture :: Ord => [a] -> [b] -> Int
capture xs ys = length [x | x <- xs,(not (elem x ys))]


x = combinations 4 [1..10]
--capture x []

0 comments on commit ff06332

Please sign in to comment.