Maintainer | bastiaan.heeren@ou.nl |
---|---|
Stability | provisional |
Portability | portable (depends on ghc) |
Safe Haskell | None |
Language | Haskell98 |
Common functions on expressions or math types.
Synopsis
- unchainAll :: [Math] -> ([Math], Bool)
- unchain :: [Expr] -> ([Equation Expr], Bool)
- getVar :: Expr -> Maybe Expr
- getVarS :: Expr -> Maybe String
- vars :: Expr -> [String]
- isNat :: Expr -> Bool
- isVar :: Expr -> Bool
- hasVar :: Expr -> Bool
- isNumber :: Expr -> Bool
- isAtom :: Expr -> Bool
- isDiv :: Expr -> Bool
- hasExpr :: Expr -> Expr -> Bool
- closestInList :: [Expr] -> Expr -> Maybe Expr
- changeOp :: Expr -> [Expr]
- equivalentStructure :: Expr -> Expr -> Bool
- changeSet :: Expr -> Expr -> [(Expr, Expr)]
- getLeft :: Expr -> Maybe Expr
- getRight :: Expr -> Maybe Expr
- getMostLeft :: Expr -> Maybe Expr
- replaceLeft :: Expr -> Expr -> Expr
- replaceRight :: Expr -> Expr -> Expr
- roundNumber :: Int -> Expr -> Expr
- normalizeIfNF :: Expr -> Expr
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
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