Answer by AndrewC for Haskell: Understanding algebraic data types better
You seem to want to make an ADT for polynomials, but I'd prefer to use a Map. First some imports:import qualified Data.Map as Mimport Data.Function (on)A polynomial is a Map from powers of x to...
View ArticleAnswer by AndrewC for Haskell: Understanding algebraic data types better
Here's an alternative solution to the other one I posted. You seem to want to make an ADT for polynomials, where I'd use a Map, but let's go with a list of terms. First some imports:import...
View ArticleHaskell: Understanding algebraic data types better
I'm trying to construct an algebraic data type that represents polynomials. Given the definition that an Integer constant is a polynomial and that if you add two polynomials or multiply two...
View Article
More Pages to Explore .....