iCog-Labs-Dev / metta-moses

Meta Optimization Semantic Evolutionary Search
3 stars 14 forks source link

Optimize `removeElement` function to use non determinism #137

Closed Yagth closed 2 weeks ago

Yagth commented 3 weeks ago

Detailed Description

The current implementation of removeElement defined and used in promote-common-constraints.metta utilizes car-atom and cdr-atom to iterate and remove all the atoms in the first input expression from the second one. i.e., It removes the atom A and B given the tuple (A B) from another tuple of (A B D E F) and returns the updated tuple (D E F). 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.

Context

The implementation of this function should:

Possible Implementation A possible implementation of this code could be done using the builtin subtraction function or using the current logic and reducing the iteration by one level using the refactored isMember function found in the issue #134.

Yagth commented 3 weeks ago

Refactor removeElement function to use non determinism

Yagth commented 2 weeks ago

Resolved by PR #149