diff --git a/kalk/src/interpreter.rs b/kalk/src/interpreter.rs index c00beea..073e78a 100644 --- a/kalk/src/interpreter.rs +++ b/kalk/src/interpreter.rs @@ -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( diff --git a/kalk/src/parser.rs b/kalk/src/parser.rs index a4e155d..b225f69 100644 --- a/kalk/src/parser.rs +++ b/kalk/src/parser.rs @@ -504,7 +504,9 @@ fn parse_identifier(context: &mut Context) -> Result { 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; } diff --git a/kalk/src/prelude/mod.rs b/kalk/src/prelude/mod.rs index 1ed89eb..2937dc0 100644 --- a/kalk/src/prelude/mod.rs +++ b/kalk/src/prelude/mod.rs @@ -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) diff --git a/kalk_cli/src/repl.rs b/kalk_cli/src/repl.rs index 0bde319..48031ab 100644 --- a/kalk_cli/src/repl.rs +++ b/kalk_cli/src/repl.rs @@ -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", "√");