Fix f(x) = x^x not working, closing #117

This commit is contained in:
PaddiM8 2023-07-20 00:34:04 +02:00
parent 1318809218
commit 2fea9777d6
2 changed files with 7 additions and 2 deletions

View File

@ -315,7 +315,10 @@ fn analyse_binary(
Identifier::from_full_name("transpose"), Identifier::from_full_name("transpose"),
vec![analyse_expr(context, left)?], vec![analyse_expr(context, left)?],
)), )),
(Expr::Var(identifier), right) => analyse_var(context, identifier, None, Some(right)), (Expr::Var(identifier), right) => {
let right = analyse_expr(context, right)?;
analyse_var(context, identifier, None, Some(right))
},
(left, right) => Ok(Expr::Binary( (left, right) => Ok(Expr::Binary(
Box::new(analyse_expr(context, left)?), Box::new(analyse_expr(context, left)?),
TokenKind::Power, TokenKind::Power,

View File

@ -1,5 +1,7 @@
x = 2 x = 2
y = 3 y = 3
f(x) = 2x(x - 3)(y + 2) f(x) = 2x(x - 3)(y + 2)
g(x) = x^x
2f(f(x) + y) * 2 = 13600 2f(f(x) + y) * 2 = 13600 and
g(2) = 4