Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Substituting variables in unified expressions #33

Closed
jarble opened this issue Jul 10, 2022 · 4 comments
Closed

Substituting variables in unified expressions #33

jarble opened this issue Jul 10, 2022 · 4 comments
Labels
question Further information is requested

Comments

@jarble
Copy link

jarble commented Jul 10, 2022

Does this library have a method to substitute variables in expressions after they have been unified?
It seems that the expressions are unchanged after unification:

from unification import *
anti1 = [var("x"),">","4"]
anti2 = ["3",">",var("y")]
unify(anti1,anti2)
print(anti1)

This program prints [~x, '>', '4'], but I wanted to get ['3', '>', '4'] instead.

@brandonwillard brandonwillard added the question Further information is requested label Jul 11, 2022
@brandonwillard
Copy link
Member

brandonwillard commented Jul 11, 2022

See unification.reify.

In your example, it can be used as follows:

s = unify(anti1, anti2)
reify(anti1, s)
# ['3', '>', '4']

@jarble
Copy link
Author

jarble commented Jul 11, 2022

@brandonwillard Is this function documented anywhere? The README doesn't mention it.

@brandonwillard
Copy link
Member

It's been added: #34.

@brandonwillard
Copy link
Member

Nope, here instead: #35.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants