IneqSolvTester.hs revision 959d7040e951c96a5ca372a8df69f7dc92bc0309
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedermodule Main where
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederimport GMP.IneqSolver
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaederprintResult :: [Int] -> [Int] -> Int -> IO ()
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian MaederprintResult n p lim =
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder let res = ineqSolver (Coeffs n p) lim
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder in putStr ("Solutions: " ++ show res ++ "\n")
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederst :: ([Int], [Int], Int) -> [Int]
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederst = \(x,_,_)->x
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedernd :: ([Int], [Int], Int) -> [Int]
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedernd = \(_,x,_)->x
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederrd :: ([Int], [Int], Int) -> Int
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maederrd = \(_,_,x)->x
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedermain :: IO()
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maedermain = do
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder{- to be used as a stub
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder line <- getLine
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder let i = ([],[],0)
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder putStr ("Coefficients: " ++ show (st i) ++ " " ++ show (nd i) ++ " "
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder ++ "Limit: " ++ show (rd i) ++ "\n")
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder printResult (st i) (nd i) (rd i)
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder-}
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder let i1 = ([13],[1],20)
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder putStr ("Coefficients: " ++ show (st i1) ++ " " ++ show (nd i1) ++ " "
7439eb4a3269fa24aebfe522eb5be6f212e618e2Christian Maeder ++ "Limit: " ++ show (rd i1) ++ "\n")
printResult (st i1) (nd i1) (rd i1)
line <- getLine
let i2 = ([1],[1],4)
putStr ("Coefficients: " ++ show (st i2) ++ " " ++ show (nd i2) ++ " "
++ "Limit: " ++ show (rd i2) ++ "\n")
printResult (st i2) (nd i2) (rd i2)
line <- getLine
let i3 = ([2,3],[1],10)
putStr ("Coefficients: " ++ show (st i3) ++ " " ++ show (nd i3) ++ " "
++ "Limit: " ++ show (rd i3) ++ "\n")
printResult (st i3) (nd i3) (rd i3)
line <- getLine
let i = ([2,3],[1],7)
putStr ("Coefficients: " ++ show (st i) ++ " " ++ show (nd i) ++ " "
++ "Limit: " ++ show (rd i) ++ "\n")
printResult (st i) (nd i) (rd i)
line <- getLine
let i = ([1,0],[0,2],5)
putStr ("Coefficients: " ++ show (st i) ++ " " ++ show (nd i) ++ " "
++ "Limit: " ++ show (rd i) ++ "\n")
printResult (st i) (nd i) (rd i)
line <- getLine
let i = ([1],[],2)
putStr ("Coefficients: " ++ show (st i) ++ " " ++ show (nd i) ++ " "
++ "Limit: " ++ show (rd i) ++ "\n")
printResult (st i) (nd i) (rd i)