-
Notifications
You must be signed in to change notification settings - Fork 37
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
Possibilities rewrite rules LHS unclear #1630
Comments
I am afraid a part of your data type is missing. I expect an equation using the eqn keyword. |
The equations are listed in the text.
|
I think that this is indeed due to |
This is indeed correct. Rewriting works with matching of patterns. If there is no match, -- as in your case -- |
Would it then not be a good idea to check whether the left hand side of rewrite rules consists of a top term with only constructors as subterms. If this is violated (as is the case in my example) a warning could be given: "Warning, the left hand side of the rewrite rule test(ls <| i) = i; contains subterms that are not constructors. The rewrite rule will therefore never match a term." |
I do like this. For your rule, there could be a matching term namely test(l <| i) where l is a variable. In such a case |
Suppose we have
Then the equation
test(i |> ls) = i
is fine.test[i]
will be rewritten toi
. However,test(ls <| i) = i
is not fine,test([1])
can not be rewritten further. I suspect left append is a constructor for lists while right append is not (and only constructors can be used in the left hand side?). I understand not every left hand side of a rewrite rule can be used for matching. However, for the user it is unclear what will work and what will not. It would be good warn the user that a rewrite rule is not usable for matching.The text was updated successfully, but these errors were encountered: