-
Notifications
You must be signed in to change notification settings - Fork 18
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
What is the most idiomatic way for "filtering" tuples in Metta? #52
Comments
Unfortunately I can't come with non-functional variant either. Probably @Necr0x0Der or @vsbogd could help out with your question. |
It is not possible to use I am not sure I understand your question correctly though. Do you mean if |
More context would be appreciated. Maybe, the initial representation is just inconvenient. For example, instead of |
Yes.
Let's suppose that it doesn't matter. |
Your usecase is still not clear, but what's about something like this?
|
Taking the example above, how to make a set of entities, which are in |
Is it a filtering example? If it's so then it gives the same result as |
there is a typo; it should be
Although, if |
Maybe, this is the right way
|
|
For me this code still gives |
Well, this code is definitely for getting all the member of all the sets, which include
OTOH, one can write something like:
The nested scenario is more complex. So, the question was if it is necessary to work with tuples or another representation of sets can be used. |
Suppose we have a tupe of atoms
(alpha beta gamma delta delta)
. How to filter outdelta
?Now suppose we have a tupe of strings
("alpha" "beta" "gamma" "delta" "delta")
. How to filter out 'delta' most effectively in this case?Lets consider nested scenarios:
(alpha beta gamma (delta (delta)))
and("alpha" "beta" "gamma" ("delta" ("delta")))
. What should be done in this case?I'm afraid the ways to solve this I could imagine right away are more "functional" and not effective like recursive functions from SICP examples.
I suspect it can be done by a matching technique but don't get how to correctly formulate desired output for
match
. Needs some sql's'EXCEPT'
analog or whatever.The text was updated successfully, but these errors were encountered: