File: range.tex

package info (click to toggle)
cadabra2 2.4.3.2-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 78,732 kB
  • sloc: ansic: 133,450; cpp: 92,064; python: 1,530; javascript: 203; sh: 184; xml: 182; objc: 53; makefile: 51
file content (30 lines) | stat: -rw-r--r-- 698 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
\cdbalgorithm{range}{}

Replaces a two-element list of integers
  with the elements in the range,
\begin{screen}{1,2,4}
{-3,2};
@range(%);
\{ -3,-2,-1,0,1,2 \}
@range[{1,3}];
\{ 1,2,3 \}
\end{screen}
When the list has three elements, the algorithm generates a list
consisting of a number of copies of the third element of the given
list,
\begin{screen}{1}
@range[{1,3,c}];
{c,c,c};
\end{screen}
When the list contains four elements, the first one is used as a
counter, and can appear in the fourth element to generate different
list elements,
\begin{screen}{1}
@range[{i, 1, 5, c_{i} }];
{ c_1, c_2, c_3, c_4, c_5 };
\end{screen}
~

\cdbseealgo{inner}
\cdbseealgo{length}
\cdbseealgo{coefficients}