Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
sdwoodbury committed Oct 7, 2014
2 parents 198872b + 26c2eec commit a1e2121
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions mattsjunk.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,25 @@ addstudent s curstu = head [ (y, s: x) | let x = snd curstu , let y = fst curstu
outputlist :: Int -> [[Int]]
outputlist numgroup = map (drop 1) (map (:[]) [1..(numgroup)])

--checkoutputlist (ss) curstu ol=
--checkoutputlist (ss) lookfor ol=
-- if (not . (elem curstu ol))
-- then if
-- map curstu currentstudent `checkindividual`
-- map currentstudent map lookfir `checkindividual`
-- then
{-
lookfor = studentid to check
currentstudent = tuple
-}
checkoutputlist :: StudentStruct -> Int -> [Int] -> Bool
checkisinoutputlist ss curstu ol
|(elem curstu ol) = True
|otherwise = False

--checkoutputlist ss curstu ol

{-
-}
checkgrouplist gl studenttuple = [ checkindividual x studenttuple | x <- gl ]

{-
Updates the current list of already grouped
Expand All @@ -55,11 +68,10 @@ updategroupedlist n l = filter (not . (==n)) l
otherwise will add student to group
TODO needs to the update grouped already list
-}
checkindividual :: Eq a => a -> (t, [a]) -> Either (t, [a]) Bool
checkindividual lookingfor currentstudent =
case elem lookingfor $ snd currentstudent of
True -> Right True
False -> Left $ addstudent lookingfor currentstudent

checkindividual lookingfor currentstudent
|(elem lookingfor $ snd currentstudent )== True = True
|otherwise = False

{-
altcheckind lookingfor currentstudent =
Expand All @@ -86,8 +98,8 @@ checkmod x y = ( if mod x y == 0
call checkindividual lfor = student to look for
x is just the size of list
-}
checkall :: Eq a => [(t, [a])] -> a -> [Either (t, [a]) Bool]
checkall students lfor = [ checkindividual lfor (students !! index )| index <- [1..((length students )-1)]]
--checkall :: Eq a => [(t, [a])] -> a -> [Either (t, [a]) Bool]
--checkall students lfor = [ checkindividual lfor (students !! index )| index <- [1..((length students )-1)]]

{-
Keep running till current group size is filled
Expand Down

0 comments on commit a1e2121

Please sign in to comment.