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

unary negation handling is broken in ->JavaScript #108

Open
littleredcomputer opened this issue Mar 6, 2023 · 3 comments
Open

unary negation handling is broken in ->JavaScript #108

littleredcomputer opened this issue Mar 6, 2023 · 3 comments
Assignees

Comments

@littleredcomputer
Copy link
Contributor

littleredcomputer commented Mar 6, 2023

Minimal repro:

user=> (->JavaScript (simplify (* -2 (+ 'x 'y))))
"function(x, y) {\n  return -2 * x -2 * y;\n}"

This may work, but it looks like it has promoted the -2 from unary negation to binary subtract, which I find suspicious. Can this be correct in all cases?

@littleredcomputer littleredcomputer self-assigned this Mar 6, 2023
@sritchie
Copy link
Member

sritchie commented Mar 6, 2023

Oh yeah, another one I ran into had to do with dashes being illegal... we need to transform them to underscores.

@littleredcomputer
Copy link
Contributor Author

I think we may have been getting away with this, but I'm going to make it a bit more principled instead of just looking for an initial hyphen in the string rep of the next term in the sum. Also, will make it work for -k instead of just -1

@sritchie
Copy link
Member

Just checked to see if this was fixed by CSE and it looks like it's still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants