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

Add an "inverter" concept, so that functions can generate lists of possible arguments #217

Open
julianhyde opened this issue Jan 21, 2024 · 1 comment

Comments

@julianhyde
Copy link
Collaborator

Consider the query

from s where String.isPrefix s "abcd";

We know how to invert the function and find the list of values of s such that String.isPrefix s "abcd" will return true. In fact it's a property of the String.isPrefix function.

So, we allow functions to declare inverters. In this case, the String.isPrefix function accepts the argument pattern "f a0 a1", and if argument 0 is the goal - the variable whose possible values we wish to enumerate - then we can generate the expression prefixesOf a1.

At first only built-in functions will be able to declare inverters. But later we will allow user-defined functions to define them. We may also convert existing logic - e.g. that a0 elem a1 can be inverted and a1 is the list of possible values of a0 - into inverters.

julianhyde added a commit to julianhyde/morel that referenced this issue Jan 21, 2024
@julianhyde
Copy link
Collaborator Author

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

1 participant