-
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
Canonical way to process and/or present complex expressions with nested subexpressions #32
Comments
A few questions:
If all the answers are 'yes', then, would it work for you:
? |
Let's suppose yes. But what other options might there be?
Yes, and here you describe the rule directly for the X coordinate. And now it's pretty obvious, but I didn't think that way, I tried to match first
Not necessarily, what if it is an expression for a 100-dimensional line? In this case, the name “vertical” maybe not very appropriate, but anyway. |
OK, if we suppose an extension to N-dimensional case, I'd propose to either wrap coordinates into the List-like data structure or to pass a tuple with coordinates and use |
An interesting option would be the possibility to be able to construct a pattern like |
It’s not clear how to process (or present) complex expressions like
(a (c b1 b2) (c b3 b4)
with nested subexpressions using metta. For example, there are expressions that specify line segments
I would like to have a function that would return all vertical lines
(_vertical $x)
Here we need to match segments with the same X coordinate at the points. It is not clear then how to proceed to matching two points if one argument is supplied to
(_vertical $x)
.One can write
(= (_vertical $x $y) (match &self (seg $x $y) ($x $y)))
and points will be returned
[((point 1 1) (point 1 2)), ((point 1 1) (point 2 1))]
But then it is not clear how to match them, since they are specified in the subexpression
(seg . .)
Of course, we can write this manually
It seems to work like this, but what if there are many more such subexpressions?
The text was updated successfully, but these errors were encountered: