Skip to content

Commit

Permalink
Fix f(x) = x^x not working, closing #117
Browse files Browse the repository at this point in the history
  • Loading branch information
PaddiM8 committed Jul 19, 2023
1 parent 1318809 commit 2fea977
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion kalk/src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,10 @@ fn analyse_binary(
Identifier::from_full_name("transpose"),
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(
Box::new(analyse_expr(context, left)?),
TokenKind::Power,
Expand Down
4 changes: 3 additions & 1 deletion tests/basics.kalker
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
x = 2
y = 3
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

0 comments on commit 2fea977

Please sign in to comment.