Skip to content

Commit

Permalink
Preserve ListExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Dec 25, 2024
1 parent bc8a285 commit a9792ff
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mathics/core/expression.py
Original file line number Diff line number Diff line change
Expand Up @@ -1410,8 +1410,13 @@ def rules():
if not isinstance(result, EvalMixin):
return result, False
if result.sameQ(new):
new._timestamp_cache(evaluation)
return new, False
# Even though result and new may be the same,
# new can be a Expression[SymbolConstant: System`List...]
# while "result' might be ListExpression!?
# So make sure to use "result", not "new".
if isinstance(result, Expression):
result._timestamp_cache(evaluation)
return result, False
else:
return result, True

Expand Down

0 comments on commit a9792ff

Please sign in to comment.