Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make pure complex numbers work again #1380

Merged
merged 2 commits into from
Aug 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 5 additions & 0 deletions tests/test_complex.py
Original file line number Diff line number Diff line change
Expand Up @@ -902,3 +902,8 @@ def test_adjacent_filter():
def test_multiple_lists_assign():
stack = run_vyxal("`hello`130f`hel`fȦ")
assert stack[-1] == "lhleo"


def test_complex_numbers():
stack = run_vyxal("°2")
assert stack[-1] == 2 * sympy.I
2 changes: 1 addition & 1 deletion vyxal/transpile.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def transpile_token(

parts = "+".join(parts)
if parts[0] == "+":
parts = (parts or "1") + "I"
parts = (parts or "1") + "* I"
elif parts[-1] == "+":
parts = parts + "1 * I"
elif "+" in parts:
Expand Down