-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
More simplify wildcards #1915
More simplify wildcards #1915
Conversation
isUnit would never be encountered because units are stored as a part of ConstantNodes.
Your PR looks really simple and elegant @thatcomputerguy0101, thanks! Nice job. I think the documentation of the different wildcards you've put on top should also be in the comments in the code of Do you have some ideas to implement a couple of rules that actually use the new wildcards? To prove its value 😄 . And does the current unit tests show that the original issue #1406 is fixed now? |
I have fixed the styling preference that you mentioned for the import. When working on unit tests, I found that commit 556f0ff (a merge from |
That's odd. Can it be that something went wrong when merging or so? The change to What I myself do most of the time when something went wrong with my git is check a new |
Stupid question: did you run |
Well, the stupid question was the right one. Since most changes don't result in different npm modules, I didn't think to do that. |
👍 great to hear that was the cause. |
I see you did write documentation @thatcomputerguy0101 👍 . Can you please move the docs to the top comment, around line 110 of the file? That comment will be used by the doc generator. |
Thanks for the update. I think the current implementation is solid and good to go. What do you think about the following comment I made?
|
I have added tests based off of #1406. I'm not against adding rules for the other wildcards, but I haven't thought of anything that works in the official ruleset yet. |
It feels a bit odd to implement a new set of wildcards if we have no idea about an actual use case. Shouldn't we at least go through the existing rules to see where we can improve them, for example by replacing |
I have went through the existing rules replacing |
Thanks for getting back on this PR @thatcomputerguy0101 . I see you indeed replaced occurrences of |
Yes, actually, for the rule Based on that, I've added tests for the two scenarios that have different outputs, but left the other two scenarios untested. |
Thanks for the update @thatcomputerguy0101 , the new unit tests are helpful! So I think this PR is ready to be merged (one minor open comment only). I'll have another brief look at it coming Monday and then merge it. |
Published now in |
This is a fix to #1406 based on some of the discussion in #1435 that maintains compatibility with the current implementation. It adds several new wildcards for simplification rules according to the list below.
n
- Any node [existed prior to change]c
- A constant literal (5 or 3.2) [existed prior to change]cl
- A constant literal; same asc
ci
- A decimal literal (5 or -3.2)ce
- A constant expression (-5 or √3)v
- A variable; anything not matched byc
(-5 or x) [existed prior to change]vl
- A variable literal (x or y)vi
- A non-decimal expression; anything not matched byci
(x or √3)ve
- A variable expression; anything not matched byce
(x or 2x)Currently, this PR contains library modifications and basic unit tests for the new code.