module Simplify where
— Write all of your code in this file!
import Expr
Copyright By PowCoder代写 加微信 powcoder
import Poly
——————————————————————————–
— * Task 1
— Define add, which adds 2 expressions together without introducing
— any ‘junk’.
add :: Expr -> Expr -> Expr
add expr1 expr2 = error “Implement me!”
——————————————————————————–
— * Task 2
— Define mul, which multiplies 2 expressions together without introducing
— any ‘junk’.
mul :: Expr -> Expr -> Expr
mul expr1 expr2 = error “Implement me!”
——————————————————————————–
— * Task 3
— Define addAll, which adds a list of expressions together into
— a single expression without introducing any ‘junk’.
addAll :: [Expr] -> Expr
addAll exprs = error “Implement me!”
——————————————————————————–
— * Task 4
— Define mulAll, which multiplies a list of expressions together into
— a single expression without introducing any ‘junk’.
mulAll :: [Expr] -> Expr
mulAll exprs = error “Implement me!”
——————————————————————————–
— * Task 5
— Define exprToPoly, which converts an expression into a polynomial.
exprToPoly :: Expr -> Poly
exprToPoly expr = error “Implement me!”
——————————————————————————–
— * Task 6
— Define polyToExpr, which converts a polynomial into an expression.
polyToExpr :: Poly -> Expr
polyToExpr poly = error “Implement me!”
——————————————————————————–
— * Task 7
— Define a function which simplifies an expression by converting it to a
— polynomial and back again.
simplify :: Expr -> Expr
simplify expr = error “Implement me!”
——————————————————————————–
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com