Advise-me-0.1: Assessment services for the Advise-Me project

Maintainerbastiaan.heeren@ou.nl
Stabilityprovisional
Portabilityportable (depends on ghc)
Safe HaskellNone
LanguageHaskell98

Recognize.Expr.Functions

Description

Common functions on expressions or math types.

Synopsis

Documentation

unchainAll :: [Math] -> ([Math], Bool) Source #

If there is a math that is a chained equation then split it up in a list of math types.

unchain :: [Expr] -> ([Equation Expr], Bool) Source #

From a list of expressions create a list of equations

getVar :: Expr -> Maybe Expr Source #

gets the first found var if present

getVarS :: Expr -> Maybe String Source #

gets the string of the first found var if present

vars :: Expr -> [String] Source #

Get the strings of all present vars in the expression

isNat :: Expr -> Bool Source #

Is a natural number

isVar :: Expr -> Bool Source #

Is a variable

hasVar :: Expr -> Bool Source #

Has a variable

isNumber :: Expr -> Bool Source #

Is a number

isAtom :: Expr -> Bool Source #

Is a natural number, variable or number

isDiv :: Expr -> Bool Source #

Is a division

hasExpr :: Expr -> Expr -> Bool Source #

Has some expression as a subexpression

Check Recognize.SubExpr for more complicated cases

closestInList :: [Expr] -> Expr -> Maybe Expr Source #

Given a list of expression and some target expression.

Return the expression that is closest to the target expression.

changeOp :: Expr -> [Expr] Source #

If the given expression is a binary operator then replace its operator with plus,minus,times and division otherwise return an empty list

equivalentStructure :: Expr -> Expr -> Bool Source #

Determines whether two expressions share the same structure without taking atomic values in consideration. eg: a + 6 == 4 + 2

changeSet :: Expr -> Expr -> [(Expr, Expr)] Source #

Generate the atoms that are not equal between the two expressions

getLeft :: Expr -> Maybe Expr Source #

Get the left or right argument of the direct children of the expression

getRight :: Expr -> Maybe Expr Source #

Get the left or right argument of the direct children of the expression

getMostLeft :: Expr -> Maybe Expr Source #

Traverse as far left as possible and return the found atom

replaceLeft :: Expr -> Expr -> Expr Source #

Replace the left or right argument of the direct children of the expression

replaceRight :: Expr -> Expr -> Expr Source #

Replace the left or right argument of the direct children of the expression

roundNumber :: Int -> Expr -> Expr Source #

Round and simplify an expression to a specified precision

normalizeIfNF :: Expr -> Expr Source #

Normalize the argument of a normalize expression