mirror of
https://github.com/PaddiM8/kalker.git
synced 2025-02-28 14:21:29 +01:00
Created synonym 'integral' for 'integrate'
This commit is contained in:
parent
515b2f16b2
commit
9fa19cb770
@ -364,7 +364,7 @@ pub(crate) fn eval_fn_call_expr(
|
|||||||
|
|
||||||
return Ok(sum);
|
return Ok(sum);
|
||||||
}
|
}
|
||||||
"integrate" | "∫" => {
|
"integrate" | "integral" | "∫" => {
|
||||||
// Make sure exactly 3 arguments were supplied.
|
// Make sure exactly 3 arguments were supplied.
|
||||||
if expressions.len() != 3 {
|
if expressions.len() != 3 {
|
||||||
return Err(CalcError::IncorrectAmountOfArguments(
|
return Err(CalcError::IncorrectAmountOfArguments(
|
||||||
|
@ -504,7 +504,9 @@ fn parse_identifier(context: &mut Context) -> Result<Expr, CalcError> {
|
|||||||
if !parse_as_var_instead && match_token(context, TokenKind::OpenParenthesis) {
|
if !parse_as_var_instead && match_token(context, TokenKind::OpenParenthesis) {
|
||||||
advance(context);
|
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 {
|
if is_integral {
|
||||||
context.is_in_integral = true;
|
context.is_in_integral = true;
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,7 @@ pub fn is_prelude_func(identifier: &str) -> bool {
|
|||||||
identifier == "sum"
|
identifier == "sum"
|
||||||
|| identifier == "Σ"
|
|| identifier == "Σ"
|
||||||
|| identifier == "integrate"
|
|| identifier == "integrate"
|
||||||
|
|| identifier == "integral"
|
||||||
|| identifier == "∫"
|
|| identifier == "∫"
|
||||||
|| UNARY_FUNCS.contains_key(identifier)
|
|| UNARY_FUNCS.contains_key(identifier)
|
||||||
|| BINARY_FUNCS.contains_key(identifier)
|
|| BINARY_FUNCS.contains_key(identifier)
|
||||||
|
@ -112,6 +112,7 @@ lazy_static! {
|
|||||||
m.insert("gamma", "Γ");
|
m.insert("gamma", "Γ");
|
||||||
m.insert("sum", "Σ()");
|
m.insert("sum", "Σ()");
|
||||||
m.insert("integrate", "∫()");
|
m.insert("integrate", "∫()");
|
||||||
|
m.insert("integral", "∫()");
|
||||||
m.insert("phi", "ϕ");
|
m.insert("phi", "ϕ");
|
||||||
m.insert("pi", "π");
|
m.insert("pi", "π");
|
||||||
m.insert("sqrt", "√");
|
m.insert("sqrt", "√");
|
||||||
|
Loading…
Reference in New Issue
Block a user