-
Notifications
You must be signed in to change notification settings - Fork 25
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
Match arbitrary function #62
Comments
You mean a pattern where If the functions you are considering are not actually arbitrary, that is, if you have a finite number of them that is known by the time you construct your patterns, you could achieve something similar by constructing one pattern for each function. With many-to-one matching, the performance should still be ok. |
Unfortunately the functions are completely arbitrary. Do you know how I could implement that in MatchPy? How difficult would it be? |
@wheerd should be able to give you a better answer than me. From the algorithmic point of view, right now I don't see a reason why it should be impossible. I just don't have a good feeling for how much work it would be, and if it would integrate nicely into what we already have. |
Integrating it into the one-to-one matching would be relatively easy, but I don't know about the many-to-one case. My gut feeling is that would be complicated if you want to cover all the and iterate over all possible matches. I can't give much more pointers as I haven't worked on this in three years and my knowledge got a bit rusty. |
Is there any way to match a function with a certain number of arguments? Suppose I've defined a binary function
sum
, is there a way to create a patternf(a, b)
that matchessum(x, y)
?The text was updated successfully, but these errors were encountered: