-- this equals to:
--      do i <- [0 .. setSize set - 1]
--         return $ deleteItemAt i set


-----------------------------------------------------------------------------
-- | Count the number of occurences of each set in the transactions.
--   An 'occurence' is when the set is a subset of the transaction.
countSupported :: (Ord (set it), Itemset set it) =>
    [set it] -> [set it] -> Map (set it) Int

countSupported transactions sets = Map.fromList cl
    where cl = do set <- sets
                  let cnt tr = if tr `contains` set then 1 else 0
                  let count = foldr (\tr acc -> acc + cnt tr) 0 transactions
                  return (set, count)
countSupported :: (Ord (set it), Itemset set it) =>
    [set it] -> [set it] -> Map (set it) Int
countSupported transactions sets = Map.fromList cl
    where cl = do set <- sets
                  let cnt tr = if tr `contains` set then 1 else 0
                  let count = foldr (\tr acc -> acc + cnt tr) 0 transactions
                  return (set, count)
countSupported transactions sets = Map.fromList cl
    where cl = do set <- sets
                  let cnt tr = if tr `contains` set then 1 else 0
                  let count = foldr (\tr acc -> acc + cnt tr) 0 transactions
                  return (set, count)