Skip to content

Commit 02ff8fd

Browse files
committed
Markdown docs for Catenate, join and Table
1 parent fc22cac commit 02ff8fd

File tree

6 files changed

+194
-10
lines changed

6 files changed

+194
-10
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Catenate
2+
3+
```
4+
Catenate[{$l1$, $l2$, ...}]
5+
```
6+
7+
> concatenates the lists `l1$, $l2$, ...`
8+
9+
###Examples
10+
11+
```
12+
>> Catenate[{{1, 2, 3}, {4, 5}}]
13+
{1, 2, 3, 4, 5}
14+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Join
2+
```
3+
Join(l1, l2)
4+
```
5+
> concatenates the lists `l1` and `l2`.
6+
7+
###Examples
8+
9+
'Join' concatenates lists:
10+
```
11+
>> Join({a, b}, {c, d, e})
12+
{a,b,c,d,e}
13+
14+
>> Join({{a, b}, {c, d}}, {{1, 2}, {3, 4}})
15+
{{a,b},{c,d},{1,2},{3,4}}
16+
```
17+
18+
The concatenated expressions may have any head:
19+
```
20+
>> Join(a + b, c + d, e + f)
21+
a+b+c+d+e+f
22+
```
23+
24+
However, it must be the same for all expressions:
25+
```
26+
>> Join(a + b, c * d)
27+
Join(a+b,c*d)
28+
29+
>> Join(x, y)
30+
Join(x,y)
31+
32+
>> Join(x + y, z)
33+
Join(x+y,z)
34+
35+
>> Join(x + y, y * z, a)
36+
Join(x + y, y z, a)
37+
38+
>> Join(x, y + z, y * z)
39+
Join(x,y+z,y*z)
40+
```
Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,56 @@
11
## Table
22

33
```
4-
Table(expr, {x, xmax})
4+
Table(expr, {i, n})
55
```
6+
> evaluates `expr` with `i` ranging from 1 to `n`, returning a list of the results.
67
78
```
8-
Table(expr, {x, xmin, xmax})
9+
Table(expr, {i, start, stop, step})
910
```
11+
> evaluates `expr` with `i` ranging from `start` to `stop`, incrementing by `step`.
12+
13+
```
14+
Table(expr, {i, {e1, e2, ..., ei}})
15+
```
16+
> evaluates `expr` with `i` taking on the values `e1, e2, ..., ei`.
1017
11-
> generates a list of the values of `expr` when `x` runs from `xmin` to `xmax`.
12-
13-
1418
### Examples
1519
```
1620
>>> Table(x!, {x, 8})
1721
{1,2,6,24,120,720,5040,40320}
22+
23+
>> Table(x, {4})
24+
{x,x,x,x}
25+
26+
>> n=0
27+
>> Table(n= n + 1, {5})
28+
{1,2,3,4,5}
29+
30+
>> Table(i, {i, 4})
31+
{1,2,3,4}
32+
33+
>> Table(i, {i, 2, 5})
34+
{2,3,4,5}
35+
36+
>> Table(i, {i, 2, 6, 2})
37+
{2,4,6}
38+
39+
>> Table(i, {i, Pi, 2*Pi, Pi / 2})
40+
{Pi,3/2*Pi,2*Pi}
41+
42+
>> Table(x^2, {x, {a, b, c}})
43+
{a^2,b^2,c^2}
1844
```
45+
46+
'Table' supports multi-dimensional tables:
47+
```
48+
>> Table({i, j}, {i, {a, b}}, {j, 1, 2})
49+
{{{a,1},{a,2}},{{b,1},{b,2}}}
50+
51+
>> Table(x, {x,0,1/3})
52+
{0}
53+
54+
>> Table(x, {x, -0.2, 3.9})
55+
{-0.2,0.8,1.8,2.8,3.8}
56+
```
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Catenate
2+
3+
```
4+
Catenate[{$l1$, $l2$, ...}]
5+
```
6+
7+
> concatenates the lists `l1$, $l2$, ...`
8+
9+
###Examples
10+
11+
```
12+
>> Catenate[{{1, 2, 3}, {4, 5}}]
13+
{1, 2, 3, 4, 5}
14+
```
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
## Join
2+
```
3+
Join(l1, l2)
4+
```
5+
> concatenates the lists `l1` and `l2`.
6+
7+
###Examples
8+
9+
'Join' concatenates lists:
10+
```
11+
>> Join({a, b}, {c, d, e})
12+
{a,b,c,d,e}
13+
14+
>> Join({{a, b}, {c, d}}, {{1, 2}, {3, 4}})
15+
{{a,b},{c,d},{1,2},{3,4}}
16+
```
17+
18+
The concatenated expressions may have any head:
19+
```
20+
>> Join(a + b, c + d, e + f)
21+
a+b+c+d+e+f
22+
```
23+
24+
However, it must be the same for all expressions:
25+
```
26+
>> Join(a + b, c * d)
27+
Join(a+b,c*d)
28+
29+
>> Join(x, y)
30+
Join(x,y)
31+
32+
>> Join(x + y, z)
33+
Join(x+y,z)
34+
35+
>> Join(x + y, y * z, a)
36+
Join(x + y, y z, a)
37+
38+
>> Join(x, y + z, y * z)
39+
Join(x,y+z,y*z)
40+
```
Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,56 @@
11
## Table
22

33
```
4-
Table(expr, {x, xmax})
4+
Table(expr, {i, n})
55
```
6+
> evaluates `expr` with `i` ranging from 1 to `n`, returning a list of the results.
67
78
```
8-
Table(expr, {x, xmin, xmax})
9+
Table(expr, {i, start, stop, step})
910
```
11+
> evaluates `expr` with `i` ranging from `start` to `stop`, incrementing by `step`.
12+
13+
```
14+
Table(expr, {i, {e1, e2, ..., ei}})
15+
```
16+
> evaluates `expr` with `i` taking on the values `e1, e2, ..., ei`.
1017
11-
> generates a list of the values of `expr` when `x` runs from `xmin` to `xmax`.
12-
13-
1418
### Examples
1519
```
1620
>>> Table(x!, {x, 8})
1721
{1,2,6,24,120,720,5040,40320}
22+
23+
>> Table(x, {4})
24+
{x,x,x,x}
25+
26+
>> n=0
27+
>> Table(n= n + 1, {5})
28+
{1,2,3,4,5}
29+
30+
>> Table(i, {i, 4})
31+
{1,2,3,4}
32+
33+
>> Table(i, {i, 2, 5})
34+
{2,3,4,5}
35+
36+
>> Table(i, {i, 2, 6, 2})
37+
{2,4,6}
38+
39+
>> Table(i, {i, Pi, 2*Pi, Pi / 2})
40+
{Pi,3/2*Pi,2*Pi}
41+
42+
>> Table(x^2, {x, {a, b, c}})
43+
{a^2,b^2,c^2}
1844
```
45+
46+
'Table' supports multi-dimensional tables:
47+
```
48+
>> Table({i, j}, {i, {a, b}}, {j, 1, 2})
49+
{{{a,1},{a,2}},{{b,1},{b,2}}}
50+
51+
>> Table(x, {x,0,1/3})
52+
{0}
53+
54+
>> Table(x, {x, -0.2, 3.9})
55+
{-0.2,0.8,1.8,2.8,3.8}
56+
```

0 commit comments

Comments
 (0)