iCog-Labs-Dev / metta-moses

Meta Optimization Semantic Evolutionary Search
3 stars 14 forks source link

Optimize `removeCommonLiterals` function #136

Closed Yagth closed 2 weeks ago

Yagth commented 3 weeks ago

Detailed Description

The current implementation of removeCommonLiterals defined and used in promote-common-constraints.metta utilizes car-atom and cdr-atom to iterate over a given expression in order to remove an atom in a given tuple form another nested tuple of tuples. i.e., It removes the atom A and B given the input tuple (A B) from another nested tuple of ((A C B) (A B D)) and return the updated nested tuple ((C) (D)). We can however have an optimized function that does the same thing by either utilizing the non deterministic nature of MeTTa or some builtin atom operation functions defined at the end of this file.

The implementation of this function depends on another function that will be implemented in issue #137.

Context

The implementation of this function should:

Possible Implementation A possible implementation of this code could be done using superpose, collapse and the refactored removeElement function found in the issue #137.

Yagth commented 3 weeks ago

Refactor removeCommonLiterals function to use non determinism

Yagth commented 2 weeks ago

Resolved by the PR #149