The current implementation of concatTuple defined in general-helpers.metta and used in several other places utilizes car-atom and cdr-atom to concatenate two tuples. We can however have a different implementation using the built in union function defined in MeTTa. (Documentation about this and other similar functions can be found here).
The current union function in MeTTa version 0.1.11 and 0.1.12 preserves the order of the input atom even after the operation which is the behavior we want. However, this feature might be removed in later versions and the order might as well be disturbed. But better to use it while it's still here. And we will still have our previous implementation and use it in the upcoming MeTTa version when the union function's feature gets removed.
After the implementation of this function, our code base should also be refactored so that the new function is used instead of the old concatTuple.
Context
The implementation of this function should:
yield a performance increase since the concatTuple function is used in different places.
Detailed Description
The current implementation of
concatTuple
defined in general-helpers.metta and used in several other places utilizescar-atom
andcdr-atom
to concatenate two tuples. We can however have a different implementation using the built inunion
function defined in MeTTa. (Documentation about this and other similar functions can be found here).The current
union
function in MeTTa version0.1.11
and0.1.12
preserves the order of the input atom even after the operation which is the behavior we want. However, this feature might be removed in later versions and the order might as well be disturbed. But better to use it while it's still here. And we will still have our previous implementation and use it in the upcoming MeTTa version when theunion
function's feature gets removed.After the implementation of this function, our code base should also be refactored so that the new function is used instead of the old
concatTuple
.Context
The implementation of this function should:
concatTuple
function is used in different places.