tools/hashTest.hs
changeset 9464 901e363d5837
parent 9462 4cbc9a8fd559
equal deleted inserted replaced
9462:4cbc9a8fd559 9464:901e363d5837
    42     print $ length a
    42     print $ length a
    43     putStrLn . unlines . map show $ filter (\l -> fst l == length a) $ [(hs, (p, o)) | p <- posList, o <- opsList, let hs = hashedSize . map (hash p o) $ wordsList]
    43     putStrLn . unlines . map show $ filter (\l -> fst l == length a) $ [(hs, (p, o)) | p <- posList, o <- opsList, let hs = hashedSize . map (hash p o) $ wordsList]
    44 
    44 
    45 didIunderstand' = do
    45 didIunderstand' = do
    46     a <- liftM lines getContents
    46     a <- liftM lines getContents
       
    47     print $ length a
    47     print . IS.size . IS.fromList . map (testHash . map fromEnum) $ a
    48     print . IS.size . IS.fromList . map (testHash . map fromEnum) $ a
    48     where
    49     where
    49         testHash s = let l = length s in
    50         testHash s = let l = length s in (
    50                          (s !! (l - 2) * s !! 1) + s !! (l - 1) - s !! 0
    51                          (s !! (l - 2) * s !! 1) + s !! (l - 1) - s !! 0
       
    52                          ) `mod` 256