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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ repos:
- id: check-merge-conflict
- id: debug-statements
stages: [pre-commit]
exclude: ChangeLog-spell-corrected.diff
exclude: ChangeLog-spell-corrected.diff|mathics/builtin/system.py
- id: end-of-file-fixer
stages: [pre-commit]
exclude: ChangeLog-spell-corrected.diff
Expand Down
20 changes: 11 additions & 9 deletions mathics/builtin/atomic/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,10 +269,10 @@ class CharacterEncoding(Predefined):
https://reference.wolfram.com/language/ref/$CharacterEncoding.html</url>

<dl>
<dt>'$CharacterEncoding'
<dt>'\\$CharacterEncoding'
<dd>specifies the default raw character encoding to use for input and \
output when no encoding is explicitly specified. \
Initially this is set to '$SystemCharacterEncoding'.
Initially this is set to '\\$SystemCharacterEncoding'.
</dl>

See the character encoding current is in effect and used in input and \
Expand All @@ -281,7 +281,7 @@ class CharacterEncoding(Predefined):
>> $CharacterEncoding
= ...

By setting its value to one of the values in '$CharacterEncodings', \
By setting its value to one of the values in '\\$CharacterEncodings', \
operators are formatted differently. For example,

>> $CharacterEncoding = "ASCII"; a -> b
Expand All @@ -290,13 +290,13 @@ class CharacterEncoding(Predefined):
= ...

Setting its value to 'None' restore the value to \
'$SystemCharacterEncoding':
'\\$SystemCharacterEncoding':
>> $CharacterEncoding = None;
>> $SystemCharacterEncoding == $CharacterEncoding
= True

See also <url>
:$SystemCharacterEncoding:
:\\$SystemCharacterEncoding:
/doc/reference-of-built-in-symbols/atomic-elements-of-expressions/string-manipulation/$systemcharacterencoding/</url>.
"""

Expand Down Expand Up @@ -329,7 +329,7 @@ class CharacterEncodings(Predefined):
https://reference.wolfram.com/language/ref/$CharacterEncodings.html</url>

<dl>
<dt>'$CharacterEncodings'
<dt>'\\$CharacterEncodings'
<dd>stores the list of available character encodings.
</dl>

Expand Down Expand Up @@ -430,6 +430,7 @@ class LetterNumber(Builtin):
= 2

"""

# FIXME: put the right unicode characters in a way that the
# following test works...
r"""
Expand Down Expand Up @@ -706,9 +707,9 @@ class SystemCharacterEncoding(Predefined):
"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/$SystemCharacterEncoding.html</url>
https://reference.wolfram.com/language/ref/\\$SystemCharacterEncoding.html</url>
<dl>
<dt>$SystemCharacterEncoding
<dt>\\$SystemCharacterEncoding
<dd>gives the default character encoding of the system.

On startup, the value of environment variable 'MATHICS_CHARACTER_ENCODING' \
Expand Down Expand Up @@ -899,7 +900,7 @@ def eval_form(self, expr, form, evaluation: Evaluation, options: dict):


class Transliterate(Builtin):
"""
r"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/Transliterate.html</url>
Expand Down Expand Up @@ -955,4 +956,5 @@ class Whitespace(Builtin):
>> StringReplace[" this has leading and trailing whitespace \n ", (StartOfString ~~ Whitespace) | (Whitespace ~~ EndOfString) -> ""] <> " removed" // FullForm
= "this has leading and trailing whitespace removed"
"""

summary_text = "sequence of whitespace characters"
2 changes: 1 addition & 1 deletion mathics/builtin/drawing/drawing_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ class PlotRange(Builtin):
<li>$max$ - explicit limit for each function.
<li>{$min$, $max$} - explicit limits for $y$ (2D), $z$ (3D), \
or array values.
<li>{{$x$_$min$, $x$_$max$}, {{$y_min}, {$y_max}} - explicit limits for \
<li>{{$x_{min}$, $x_{max}$}, {{$y_{min}$}, {$y_{max}$}} - explicit limits for \
$x$ and $y$.
</ul>

Expand Down
34 changes: 17 additions & 17 deletions mathics/builtin/drawing/graphics3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class Graphics3D(Graphics):
<url>:WMA link:https://reference.wolfram.com/language/ref/Graphics3D.html</url>

<dl>
<dt>'Graphics3D[$primitives$, $options$]'
<dt>'Graphics3D'[$primitives$, $options$]
<dd>represents a three-dimensional graphic.

See <url>:Drawing Option and Option Values:
Expand Down Expand Up @@ -170,11 +170,11 @@ class Sphere(Builtin):
<url>:WMA link:https://reference.wolfram.com/language/ref/Sphere.html</url>

<dl>
<dt>'Sphere[{$x$, $y$, $z$}]'
<dt>'Sphere'[{$x$, $y$, $z$}]
<dd>is a sphere of radius 1 centered at the point {$x$, $y$, $z$}.
<dt>'Sphere[{$x$, $y$, $z$}, $r$]'
<dt>'Sphere'[{$x$, $y$, $z$}, $r$]
<dd>is a sphere of radius $r$ centered at the point {$x$, $y$, $z$}.
<dt>'Sphere[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]'
<dt>'Sphere'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]
<dd>is a collection spheres of radius $r$ centered at the points \
{$x1$, $y2$, $z2$}, {$x2$, $y2$, $z2$}, ...
</dl>
Expand All @@ -198,14 +198,14 @@ class Cone(Builtin):
<url>:WMA link:https://reference.wolfram.com/language/ref/Cone.html</url>

<dl>
<dt>'Cone[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}]'
<dt>'Cone'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}]
<dd>represents a cone of radius 1.

<dt>'Cone[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}, $r$]'
<dt>'Cone'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}, $r$]
<dd>is a cone of radius $r$ starting at ($x1$, $y1$, $z1$) and ending at \
($x2$, $y2$, $z2$).

<dt>'Cone[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]'
<dt>'Cone'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]
<dd>is a collection cones of radius $r$.
</dl>

Expand Down Expand Up @@ -247,16 +247,16 @@ class Cuboid(Builtin):

Cuboid also known as interval, rectangle, square, cube, rectangular parallelepiped, tesseract, orthotope, and box.
<dl>
<dt>'Cuboid[$p_min$]'
<dt>'Cuboid'[$p_{min}$]
<dd>is a unit cube/square with its lower corner at point $p_min$.

<dt>'Cuboid[$p_min$, $p_max$]
<dd>is a 2d square with with lower corner $p_min$ and upper corner $p_max$.
<dt>'Cuboid'[$p_{min}$, $p_{max}$]
<dd>is a 2d square with with lower corner $p_{min}$ and upper corner $p_{max}$.

<dt>'Cuboid[{$p_min$, $p_max$}]'
<dt>'Cuboid'[{$p_{min}$, $p_{max}$}]
<dd>is a cuboid with lower corner $p_min$ and upper corner $p_max$.

<dt>'Cuboid[{$p1_min$, $p1_max$, ...}]'
<dt>'Cuboid'[{$p1_{min}$, $p1_{max}$, ...}]
<dd>is a collection of cuboids.

<dt>'Cuboid[]' is equivalent to 'Cuboid[{0,0,0}]'.
Expand Down Expand Up @@ -300,14 +300,14 @@ class Cylinder(Builtin):
<url>:WMA link:https://reference.wolfram.com/language/ref/Cylinder.html</url>

<dl>
<dt>'Cylinder[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}]'
<dt>'Cylinder'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}]
<dd>represents a cylinder of radius 1.

<dt>'Cylinder[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}, $r$]'
<dt>'Cylinder'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}}, $r$]
<dd>is a cylinder of radius $r$ starting at ($x1$, $y1$, $z1$) and ending at \
($x2$, $y2$, $z2$).

<dt>'Cylinder[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]'
<dt>'Cylinder'[{{$x1$, $y1$, $z1$}, {$x2$, $y2$, $z2$}, ... }, $r$]
<dd>is a collection cylinders of radius $r$.
</dl>

Expand Down Expand Up @@ -348,10 +348,10 @@ class Tube(Builtin):
<url>:WMA link:https://reference.wolfram.com/language/ref/Tube.html</url>

<dl>
<dt>'Tube[{$p1$, $p2$, ...}]'
<dt>'Tube'[{$p1$, $p2$, ...}]
<dd>represents a tube passing through $p1$, $p2$, ... with radius 1.

<dt>'Tube[{$p1$, $p2$, ...}, $r$]'
<dt>'Tube'[{$p1$, $p2$, ...}, $r$]
<dd>represents a tube with radius $r$.
</dl>

Expand Down
16 changes: 8 additions & 8 deletions mathics/builtin/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@


class RecursionLimit(Predefined):
"""
r"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/$RecursionLimit.html</url>
https://reference.wolfram.com/language/ref/\$RecursionLimit.html</url>

<dl>
<dt>'$RecursionLimit'
<dt>'\$RecursionLimit'
<dd>specifies the maximum allowable recursion depth after which a \
calculation is terminated.
</dl>

Calculations terminated by '$RecursionLimit' return '$Aborted':
Calculations terminated by '\$RecursionLimit' return '\$Aborted':
>> a = a + a
: Recursion depth of 200 exceeded.
= $Aborted
Expand Down Expand Up @@ -71,17 +71,17 @@ def evaluate(self, evaluation) -> Integer:


class IterationLimit(Predefined):
"""
<url>:WMA link:https://reference.wolfram.com/language/ref/$IterationLimit.html</url>
r"""
<url>:WMA link:https://reference.wolfram.com/language/ref/\$IterationLimit.html</url>

<dl>
<dt>'$IterationLimit'
<dt>'\$IterationLimit'

<dd>specifies the maximum number of times a reevaluation of an expression may happen.

</dl>

Calculations terminated by '$IterationLimit' return '$Aborted':
Calculations terminated by '\$IterationLimit' return '\$Aborted':

>> $IterationLimit
= 1000
Expand Down
6 changes: 3 additions & 3 deletions mathics/builtin/exp_structure/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ class SortBy(Builtin):
<dt>'SortBy[$list$, $f$]'
<dd>sorts $list$ (or the elements of any other expression) according to \
canonical ordering of the keys that are extracted from the $list$'s \
elements using $f. Chunks of elements that appear the same under $f \
are sorted according to their natural order (without applying $f).
elements using $f$. Chunks of elements that appear the same under $f$ \
are sorted according to their natural order (without applying $f$).

<dt>'SortBy[$f$]'
<dd>creates an operator function that, when applied, sorts by $f.
<dd>creates an operator function that, when applied, sorts by $f$.
</dl>

>> SortBy[{{5, 1}, {10, -1}}, Last]
Expand Down
18 changes: 9 additions & 9 deletions mathics/builtin/files_io/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@


class Input_(Predefined):
"""
<url>:WMA link:https://reference.wolfram.com/language/ref/$Input.html</url>
r"""
<url>:WMA link:https://reference.wolfram.com/language/ref/\$Input.html</url>

<dl>
<dt>'$Input'
<dt>'\$Input'
<dd>is the name of the stream from which input is currently being read.
</dl>

Expand Down Expand Up @@ -364,7 +364,7 @@ class Get(PrefixOperator):
<dt>'Get[$name$, Trace->True]'
<dd>Runs Get tracing each line before it is evaluated.

'Settings`$TraceGet' can be also used to trace lines on all 'Get[]' calls.
'Settings`\$TraceGet' can be also used to trace lines on all 'Get[]' calls.
</dl>


Expand Down Expand Up @@ -409,17 +409,17 @@ def eval(self, path: String, evaluation: Evaluation, options: dict):


class InputFileName_(Predefined):
"""
r"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/$InputFileName.html</url>
https://reference.wolfram.com/language/ref/\$InputFileName.html</url>

<dl>
<dt>'$InputFileName'
<dt>'\$InputFileName'
<dd>is the name of the file from which input is currently being read.
</dl>

While in interactive mode, '$InputFileName' is "".
While in interactive mode, '\$InputFileName' is "".
X> $InputFileName
"""

Expand Down Expand Up @@ -1126,7 +1126,7 @@ def eval_n(self, file, types, n: Integer, evaluation: Evaluation, options: dict)
py_n = n.get_int_value()
if py_n < 0:
evaluation.message(
"ReadList", "intnm", to_expression("ReadList", file, types, m)
"ReadList", "intnm", to_expression("ReadList", file, types, n)
)
return

Expand Down
6 changes: 3 additions & 3 deletions mathics/builtin/forms/__init__.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""
r"""
Forms of Input and Output

A <i>Form</i> format specifies the way Mathics Expression input is read or output \
written.

The variable <url>:$OutputForms':
/doc/reference-of-built-in-symbols/forms-of-input-and-output/form-variables/$outputforms/</url> \
The variable <url>:\$OutputForms':
/doc/reference-of-built-in-symbols/forms-of-input-and-output/form-variables/\$outputforms/</url> \
has a list of Forms defined.

See also <url>:WMA link:
Expand Down
8 changes: 4 additions & 4 deletions mathics/builtin/forms/other.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
Forms which are not in '$OutputForms'
r"""
Forms which are not in '\$OutputForms'
"""

import re
Expand All @@ -13,7 +13,7 @@


class SequenceForm(FormBaseClass):
"""
r"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/SequenceForm.html</url>
Expand Down Expand Up @@ -56,7 +56,7 @@ def eval_makeboxes(self, args, form, evaluation, options: dict):


class StringForm(FormBaseClass):
"""
r"""
<url>
:WMA link:
https://reference.wolfram.com/language/ref/StringForm.html</url>
Expand Down
8 changes: 4 additions & 4 deletions mathics/builtin/forms/variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@
class PrintForms_(Predefined):
r"""
<dl>
<dt>'$PrintForms'
<dt>'\$PrintForms'
<dd>contains the list of basic print forms. It is updated automatically when new 'PrintForms' are defined by setting format values.
</dl>

>> $PrintForms
= ...

Suppose now that we want to add a new format 'MyForm'. Initially, it does not belong to '$PrintForms':
Suppose now that we want to add a new format 'MyForm'. Initially, it does not belong to '\$PrintForms':
>> MemberQ[$PrintForms, MyForm]
= False

Now, let's define a format rule:
>> Format[F[x_], MyForm] := "F<<" <> ToString[x] <> ">>"

Now, the new format belongs to the '$PrintForms' list
Now, the new format belongs to the '\$PrintForms' list
>> MemberQ[$PrintForms, MyForm]
= True

Expand All @@ -42,7 +42,7 @@ def evaluate(self, evaluation):
class OutputForms_(Predefined):
r"""
<dl>
<dt>'$OutputForms'
<dt>'\$OutputForms'
<dd>contains the list of all output forms. It is updated automatically when new 'OutputForms' are defined by setting format values.
</dl>

Expand Down
2 changes: 1 addition & 1 deletion mathics/builtin/graphics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1393,7 +1393,7 @@ class Inset(Builtin):
<dt>'Text[$obj$, $pos$]'
<dd>represents an object $obj$ inset in a graphic at position $pos$.

<dt>'Text[$obj$, $pos$, $$]'
<dt>'Text[$obj$, $pos$, $opos$]'
<dd>represents an object $obj$ inset in a graphic at position $pos$, \
in away that the position $opos$ of $obj$ coincides with $pos$ \
in the enclosing graphic.
Expand Down
Loading