Skip to content

Commit fc8be34

Browse files
committed
Go over All docs and add an example in Part
1 parent 7df3695 commit fc8be34

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

mathics/builtin/lists.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ class All(Predefined):
380380
"""
381381
<dl>
382382
<dt>'All'
383-
<dd>is a possible option value for 'Span' and 'Quiet'. 'All' specifies all parts a a particular level.
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
attributes = ("Unprotected",)
@@ -992,8 +992,8 @@ def convert_seq(seq):
992992
class Part(Builtin):
993993
"""
994994
<dl>
995-
<dt>'Part[$expr$, $i$]'
996-
<dd>returns part $i$ of $expr$.
995+
<dt>'Part[$expr$, $i$]'
996+
<dd>returns part $i$ of $expr$.
997997
</dl>
998998
999999
Extract an element from a list:
@@ -1031,11 +1031,17 @@ class Part(Builtin):
10311031
>> B = {{a, b, c}, {d, e, f}, {g, h, i}};
10321032
>> B[[;;, 2]]
10331033
= {b, e, h}
1034+
10341035
Extract a submatrix of 1st and 3rd row and the two last columns:
10351036
>> B = {{1, 2, 3}, {4, 5, 6}, {7, 8, 9}};
1037+
10361038
>> B[[{1, 3}, -2;;-1]]
10371039
= {{2, 3}, {8, 9}}
10381040
1041+
The 3d column of a matrix:
1042+
>> {{a, b, c}, {d, e, f}, {g, h, i}}[[All, 3]]
1043+
= {c,f,i}
1044+
10391045
Further examples:
10401046
>> (a+b+c+d)[[-1;;-2]]
10411047
= 0

0 commit comments

Comments
 (0)