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:
yield a performance increase.
simplify our code.
Possible Implementation
A possible implementation of this code could be done using superpose, collapse and the refactored removeElement function found in the issue #137.
Detailed Description
The current implementation of
removeCommonLiterals
defined and used in promote-common-constraints.metta utilizescar-atom
andcdr-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 atomA
andB
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 refactoredremoveElement
function found in the issue #137.