Created synonym 'integral' for 'integrate'

This commit is contained in:
bakk 2021-05-23 00:55:35 +02:00
parent 7b635079c8
commit 34e374b346
4 changed files with 6 additions and 2 deletions

View File

@ -364,7 +364,7 @@ pub(crate) fn eval_fn_call_expr(
return Ok(sum);
}
"integrate" | "" => {
"integrate" | "integral" | "" => {
// Make sure exactly 3 arguments were supplied.
if expressions.len() != 3 {
return Err(CalcError::IncorrectAmountOfArguments(

View File

@ -504,7 +504,9 @@ fn parse_identifier(context: &mut Context) -> Result<Expr, CalcError> {
if !parse_as_var_instead && match_token(context, TokenKind::OpenParenthesis) {
advance(context);
let is_integral = identifier.full_name == "integrate" || identifier.full_name == "";
let is_integral = identifier.full_name == "integrate"
|| identifier.full_name == "integral"
|| identifier.full_name == "";
if is_integral {
context.is_in_integral = true;
}

View File

@ -159,6 +159,7 @@ pub fn is_prelude_func(identifier: &str) -> bool {
identifier == "sum"
|| identifier == "Σ"
|| identifier == "integrate"
|| identifier == "integral"
|| identifier == ""
|| UNARY_FUNCS.contains_key(identifier)
|| BINARY_FUNCS.contains_key(identifier)

View File

@ -112,6 +112,7 @@ lazy_static! {
m.insert("gamma", "Γ");
m.insert("sum", "Σ()");
m.insert("integrate", "∫()");
m.insert("integral", "∫()");
m.insert("phi", "ϕ");
m.insert("pi", "π");
m.insert("sqrt", "");