---------------------------------------------------------------------- module TermPoly where ---------------------------------------------------------------------- -- COMP2600 -- Assignment 1, 2003 -- Skeleton script -- Represent a polynomial as a list of terms, where a term is -- represented as a coefficient, exponent pair. Terms with zero -- coefficients do not appear. The terms appear in decreasing -- order of exponent. type Coeff = Float type Expon = Int type Term = (Coeff, Expon) type Poly = [Term] ---------------------------------------------------------------------- add :: Poly -> Poly -> Poly ---------------------------------------------------------------------- sub :: Poly -> Poly -> Poly ---------------------------------------------------------------------- eval :: Float -> Poly -> Float ----------------------------------------------------------------------