Skip to content

Commit d69ab0e

Browse files
authored
Merge pull request #1354 from mathics/combinatorica-2.0-prereqs
Go over Quiet, All, and Part docs
2 parents f03b43c + 8f94d19 commit d69ab0e

2 files changed

Lines changed: 20 additions & 5 deletions

File tree

mathics/builtin/inout.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1516,9 +1516,18 @@ class Quiet(Builtin):
15161516
<dd>evaluates $expr$, with messages $off$ being suppressed, but messages $on$ being displayed.
15171517
</dl>
15181518
1519+
Evaluate without generating messages:
1520+
>> Quiet[1/0]
1521+
= ComplexInfinity
1522+
1523+
Same as above:
1524+
>> Quiet[1/0, All]
1525+
= ComplexInfinity
1526+
15191527
>> a::b = "Hello";
15201528
>> Quiet[x+x, {a::b}]
15211529
= 2 x
1530+
15221531
>> Quiet[Message[a::b]; x+x, {a::b}]
15231532
= 2 x
15241533
@@ -1527,7 +1536,7 @@ class Quiet(Builtin):
15271536
: Hello
15281537
= 2 x
15291538
1530-
>> Quiet[expr, All, All]
1539+
#> Quiet[expr, All, All]
15311540
: Arguments 2 and 3 of Quiet[expr, All, All] should not both be All.
15321541
= Quiet[expr, All, All]
15331542
>> Quiet[x + x, {a::b}, {a::b}]

mathics/builtin/lists.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,8 @@ def apply(self, expr, evaluation):
379379
class All(Predefined):
380380
"""
381381
<dl>
382-
<dt>'All'
383-
<dd>is a possible value for 'Span' and 'Quiet'.
382+
<dt>'All'
383+
<dd>is a possible option value for 'Span', 'Quiet', 'Part' and related functions. 'All' specifies all parts at a particular level.
384384
</dl>
385385
"""
386386

@@ -991,8 +991,8 @@ def convert_seq(seq):
991991
class Part(Builtin):
992992
"""
993993
<dl>
994-
<dt>'Part[$expr$, $i$]'
995-
<dd>returns part $i$ of $expr$.
994+
<dt>'Part[$expr$, $i$]'
995+
<dd>returns part $i$ of $expr$.
996996
</dl>
997997
998998
Extract an element from a list:
@@ -1030,11 +1030,17 @@ class Part(Builtin):
10301030
>> B = {{a, b, c}, {d, e, f}, {g, h, i}};
10311031
>> B[[;;, 2]]
10321032
= {b, e, h}
1033+
10331034
Extract a submatrix of 1st and 3rd row and the two last columns:
10341035
>> B = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
1036+
10351037
>> B[[{1, 3}, -2;;-1]]
10361038
= {{2, 3}, {8, 9}}
10371039
1040+
The 3d column of a matrix:
1041+
>> {{a, b, c}, {d, e, f}, {g, h, i}}[[All, 3]]
1042+
= {c, f, i}
1043+
10381044
Further examples:
10391045
>> (a+b+c+d)[[-1;;-2]]
10401046
= 0

0 commit comments

Comments
 (0)