When the correct slope is 1 or is a negative it incorrectly says it is incorrect (when entered as a fraction). Can someone help me see why. I have tried to include patterns.negative, but it doens’t help. I’m sure I am doing it wrong, but I don’t know how to do it correctly.
by moving where the p.negative was in the pattern. Still having issues when the slope is 1 or -1 and not entering the 1 or -1 as in y = -x + 7 or y = x + 7.
Here’s a few edits I’d make. The sum pattern only recognizes positive terms unless you use the .allowNegativeTerms modifier, allowing pDif to be removed, as well as the need for negX. I also included the negative fraction as part of the general product pattern rather than two different patterns. A single term can be considered a sum or product, so I used p.optional for the coefficient in the product rather than using p.anyOf in the sum. Let me know if you have any questions.
One more thing I thought of you may or may not want. If you don’t want to accept the form y=b+mx, you may want to use .strictOrder for pSum and/or pProduct.