{- This wraps the factorizer up in glue code that communicates via stdin/out. The input polynomial is a string "[c0, c1, ...]" of coefficients (in increasing order of degree), the output is a string of the form "[c, [[a00, a01, ...], e0], [[a10, a11, ...], e1], ...]" with a leading coefficient c and a list of pairs (factor, exponent), where each factor is represented by its list of coefficients. -} module Main where { import Data.List; import Prelude; import System.Environment; import Factor(Nat, factor_int_poly); main = do s <- getLine let out = show (factor_int_poly (read s)) -- replace ( and ) by [ and ] to please GAP let out' = map (\c -> if c == '(' then '[' else if c==')' then ']' else c) out putStr out' }