Skip to content

Conversation

@K1rubel
Copy link
Contributor

@K1rubel K1rubel commented Nov 14, 2025

Description

Refactored code in list-methods, exemplar-selection, metapoulation, exemplar-type and the corresponding test files.
I have made a few changes in general-helpers as well, changes that ensure the changes in the above files work.

Motivation and Context

Refactoring MeTTa code to run the much faster PeTTa interpreter.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

@K1rubel K1rubel closed this Nov 14, 2025
@K1rubel K1rubel reopened this Nov 14, 2025
!(assertEqual (List.sum (Cons 1 (Cons 2 (Cons 3 (Cons 2 (Cons 3 Nil)))))) 11)
!(assertEqual (List.sum (Cons 1 (Cons 2 (Cons 3 (Cons 4 Nil))))) 10)
!(assertEqual (List.sum (Cons 3.0 (Cons 4.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 4.0 (Cons 5.0 (Cons 4.0 (Cons 4.0 (Cons 4.0 (Cons 5.0 (Cons 5.0 (Cons 4.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 4.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 5.0 (Cons 4.0 (Cons 5.0 (Cons 4.0 Nil))))))))))))))))))))))))))) 119)
!(test (List.sum (Cons 1 (Cons 2 (Cons 3 (Cons 2 (Cons 3 Nil)))))) 11)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any specific reason why you used test here but assertEqual for the rest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No particular reason. Just found that the two could be used interchagably, at lease for this case.

@@ -0,0 +1,228 @@

; !(register-module! ../../../metta-moses)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Why do we have two list-methods-test files?

@@ -0,0 +1,288 @@
; ! (register-module! ../../../metta-moses)
!(import! &self ../../../metta-moses/metapopulation/metapopulation)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question here. Why do we have two test files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thought renamed the file into *test.metta from *testold.metta. Now, manually deleted.


;; for number to string conversion
! (bind! numStr (py-atom str))
!(bind! numStr (py-atom str))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does py-atom work in PeTTa?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it doens't. When there is a file import statement PeTTa won't run if there is syntax error in the imported file. So, I was just fixing that. Not looking into the correctness of the python binidings.

@Yagth
Copy link
Collaborator

Yagth commented Nov 14, 2025

@K1rubel I just had few questions and I will merge this PR as soon as I get the answers :)

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

Successfully merging this pull request may close these issues.

2 participants