Skip to content

Commit

Permalink
Remove unneded call to evaluate()
Browse files Browse the repository at this point in the history
  • Loading branch information
rocky committed Sep 26, 2024
1 parent d8f3987 commit c669876
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions mathics/builtin/list/eol.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def eval(self, expr, evaluation: Evaluation, expression: Expression):
and len == 2
and isinstance(first_elem, Atom)
):
return expr.elements[1].evaluate(evaluation)
return expr.elements[1]

return first_elem

Expand Down Expand Up @@ -908,15 +908,7 @@ def eval(self, expr, evaluation: Evaluation, expression: Expression):
evaluation.message("Last", "argt", expr_len)
return

last_elem = expr.elements[-1]
if expr.head == SymbolSequence or (
not isinstance(expr, ListExpression)
and len == 2
and isinstance(expr.elements[0], Atom)
):
return last_elem.evaluate(evaluation)

return last_elem
return expr.elements[-1]


class Length(Builtin):
Expand Down

0 comments on commit c669876

Please sign in to comment.