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

metta function does not use provided space #803

Closed
AdrickTench opened this issue Nov 19, 2024 · 3 comments · Fixed by #804
Closed

metta function does not use provided space #803

AdrickTench opened this issue Nov 19, 2024 · 3 comments · Fixed by #804
Assignees
Labels
bug Something isn't working

Comments

@AdrickTench
Copy link

metta does not seem to use the space passed as an argument. The following demonstrates creating a new space and attempting to use it with both match and metta; match uses the space but metta does not.

!(bind! &new-space (new-space)) ;; [()]
!(add-atom &new-space (likes John Jane)) ;; [()]
!(add-atom &new-space (= (foo $x) (+ $x 1))) ;; [()]
!(match &new-space (likes $x $y) ($x $y)) ;; [(John Jane)]
!(metta (foo 1) Number &new-space) ;; [(foo 1)] - why is foo not evaluated here since we passed &new-space?
!(foo 1) ;; [(foo 1)], expected as we're in &self which hasn't defined foo
!(add-atom &self (= (foo $x) (+ $x 1))) ;; [()]
!(foo 1) ;; [2], as expected
!(metta (foo 1) Number &new-space) ;; [2] - now we evaluate foo?
@vsbogd vsbogd self-assigned this Nov 20, 2024
@vsbogd vsbogd added the bug Something isn't working label Nov 20, 2024
@vsbogd
Copy link
Collaborator

vsbogd commented Nov 20, 2024

Thanks for reporting this. Yes, it is an issue caused by incompatibility of the legacy approach which is evaluation of the MeTTa expressions doesn't input the evaluation context and new approach when context is passed. Looks like in this case it is relatively easy fixable.

@vsbogd
Copy link
Collaborator

vsbogd commented Nov 20, 2024

@AdrickTench could you please check if #804 fixes the issue for you

@AdrickTench
Copy link
Author

Confirmed:

> !(bind! &new-space (new-space))
[()]
> !(add-atom &new-space (= (foo $x) (+ $x 1)))
[()]
> !(metta (foo 1) Number &new-space)
[2]

TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Nov 21, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Nov 21, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Nov 21, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Dec 4, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Dec 4, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Dec 4, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Dec 4, 2024
TeamSPoon added a commit to trueagi-io/metta-wam that referenced this issue Dec 4, 2024
TeamSPoon added a commit to logicmoo/metta-testsuite that referenced this issue Dec 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants