From 23339c99c305bdb618b5c08b9cb5d07ec887b8e0 Mon Sep 17 00:00:00 2001 From: Maxim Tarasov Date: Thu, 9 May 2024 12:44:34 -0700 Subject: [PATCH] deepcopy Term when cloning; cache conversion from logic to term --- pynars/NARS/InferenceEngine/KanrenEngine/util.py | 1 + pynars/Narsese/_py/Term.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/pynars/NARS/InferenceEngine/KanrenEngine/util.py b/pynars/NARS/InferenceEngine/KanrenEngine/util.py index 000353c..0bfc449 100644 --- a/pynars/NARS/InferenceEngine/KanrenEngine/util.py +++ b/pynars/NARS/InferenceEngine/KanrenEngine/util.py @@ -176,6 +176,7 @@ def logic(term: Term, rule=False, substitution=False, var_intro=False, structura ################# # LOGIC TO TERM # ################# +@cache def term(logic, root=True): # additional variable handling if root: vars_all.clear() diff --git a/pynars/Narsese/_py/Term.py b/pynars/Narsese/_py/Term.py index b240611..cc39b58 100644 --- a/pynars/Narsese/_py/Term.py +++ b/pynars/Narsese/_py/Term.py @@ -217,8 +217,8 @@ def _build_vars(self): def clone(self): - # clone = copy(self) - return self + clone = deepcopy(self) + return clone def _normalize_variables(self): ''''''