Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions SYMBOLS_MANIFEST.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1023,6 +1023,7 @@ System`Refine
System`RegularExpression
System`RegularPolygon
System`RegularPolygonBox
System`Release
System`ReleaseHold
System`Remove
System`RemoveDiacritics
Expand Down
27 changes: 27 additions & 0 deletions mathics/builtin/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,33 @@ class Evaluate(Builtin):
summary_text = "evaluate the element, disregarding Hold attributes"


class Release(Builtin):
"""
<url>:WMA link:https://reference.wolfram.com/language/ref/Release.html</url>

<dl>
<dt>'Release'[$expr$]
<dd>evaluates $expr$. This is an obsolete symbol, superseded by \
'Evaluate' and 'ReleaseHold'; it is kept so that old packages \
can be read.
</dl>

>> x = 1 + 1; Release[x]
= 2

Old packages use it to build the left-hand side of a definition from \
a variable:
>> With[{name = h}, Format[Release[name][k_]] := {name, k}]; ToString[h[3]]
= {h, 3}
#> Clear[x, h]
"""

rules = {
"Release[x___]": "x",
Comment thread
rocky marked this conversation as resolved.
}
summary_text = "obsolete form of Evaluate"


class Unevaluated(Builtin):
"""
<url>:WMA link:https://reference.wolfram.com/language/ref/Unevaluated.html</url>
Expand Down
9 changes: 9 additions & 0 deletions test/builtin/test_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,15 @@
None,
),
("ClearAll[f];", None, None, None),
# Release, the obsolete form of Evaluate
("x = 1 + 1; Release[x]", None, "2", None),
(
"With[{name = h}, f[Release[name][k_]] := {name, k}]; f[h[3]]",
None,
"{h, 3}",
"Release in the left-hand side of a definition",
),
("ClearAll[f, h, x];", None, None, None),
],
)
def test_evaluation(str_expr, msgs, str_expected, fail_msg):
Expand Down
Loading