iCog-Labs-Dev / metta-moses

Meta Optimization Semantic Evolutionary Search
3 stars 14 forks source link

Optimize the `isMember` function #134

Closed Yagth closed 1 week ago

Yagth commented 3 weeks ago

Detailed Description

The isMember function used in the rte-helpers.metta file and defined in the general-helpers.metta file can be optimized since the operation can be done in parallel utilizing the non deterministic nature of MeTTa. The current implementation is iterating over the expression to determine whether an atom exists in a given expression or not.

Context

Refactoring the function as such:

Possible Implementation

A possible implementation could be utilizing the builtin intersection function found in metta. (Documentation about this and similar other functions can be found here). One can try to find the intersection of the input atom and the rest of the atom to make sure the atom exists in there or not.

Yagth commented 3 weeks ago

Refactor isMember function to utilize non determinism