This pull request refactors the getGuardSetExp function, defined in rte-helpers.metta, to optimize its performance by eliminating the need for iterative checking of each atom. The previous implementation used car-atom and cdr-atom to iterate over expressions one at a time. The new version implements a non-deterministic approach, leveraging parallel processing through superpose to evaluate guard sets more efficiently.
Motivation and Context
This change is required to improve the performance of the getGuardSetExp function. The previous iteration method introduced unnecessary overhead, making the function less efficient when evaluating large expressions. By refactoring the function, we enhance its performance and reduce latency, ultimately leading to faster evaluations of guard sets.
How Has This Been Tested?
The refactored function has been tested using existing unit tests to ensure that its output matches expected results.
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:
[x] My code follows the code style of this project.
Description
This pull request refactors the
getGuardSetExp
function, defined inrte-helpers.metta
, to optimize its performance by eliminating the need for iterative checking of each atom. The previous implementation usedcar-atom
andcdr-atom
to iterate over expressions one at a time. The new version implements a non-deterministic approach, leveraging parallel processing throughsuperpose
to evaluate guard sets more efficiently.Motivation and Context
This change is required to improve the performance of the
getGuardSetExp
function. The previous iteration method introduced unnecessary overhead, making the function less efficient when evaluating large expressions. By refactoring the function, we enhance its performance and reduce latency, ultimately leading to faster evaluations of guard sets.How Has This Been Tested?
The refactored function has been tested using existing unit tests to ensure that its output matches expected results.
Types of changes
Checklist: