packages feed

WeakSets-0.4.0.0: test/TestHomogeneousFunction.hs

module TestHomogeneousFunction where
    import Data.WeakSets.HomogeneousSet
    import Data.WeakSets.HomogeneousFunction
    
    -- | Tests all functions related to homogeneous sets.
    main :: IO ()
    main = do
            putStrLn "Beginning of TestHomogeneousSet"
            let s1 = set [1,2,3] 
            let s2 = set [3,4,5] 
            let f = function $ zip (setToList s1) (setToList s2)
            let g = function $ zip (setToList s2) (setToList s1)
            putStrLn $ show $ f
            putStrLn $ show $ g
            putStrLn $ show $ functionToSet $ f
            putStrLn $ show $ domain $ f
            putStrLn $ show $ image $ f
            putStrLn $ show $ f |?| 1
            putStrLn $ show $ f |!| 1
            putStrLn $ show $ f |.| g
            putStrLn $ show $ g |.| f
            putStrLn $ show $ memorizeFunction (*3) (set [1..10])
            putStrLn $ show $ idFromSet (set [1..10])
            putStrLn $ show $ size (idFromSet (set [1..10]))
            putStrLn $ show $ delete 3 (idFromSet (set [1..10]))
            putStrLn $ show $ adjust (+1) 3 (idFromSet (set [1..10]))
            putStrLn $ show $ adjust (+1) 13 (idFromSet (set [1..10]))
            putStrLn $ show $ union (idFromSet (set [1..10])) (idFromSet (set [5..15])) 
            putStrLn "End of TestHomogeneousSet"