Tabulate - Maple Help

StringTools

 Tabulate
 generate strings over integer ranges

 Calling Sequence Tabulate( p, n )

Parameters

 p - procedure mapping integers to characters n - positive integer or character

Description

 • The Tabulate(p, n) command generates strings over integer ranges. It constructs the string $\mathrm{cat}\left(\mathrm{seq}\left(p\left(i\right),i=1..n\right)\right)$. For an integer i in the range $1..n$, the expression $p\left(i\right)$ must evaluate to a string of type character. Typically, p is of type procedure. The second argument n must be a non-negative 32-bit integer.
 • All of the StringTools package commands treat strings as (null-terminated) sequences of $8$-bit (ASCII) characters.  Thus, there is no support for multibyte character encodings, such as unicode encodings.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > evalb( Tabulate( Char, 200 ) = Iota( 1, 200 ) );
 ${\mathrm{true}}$ (1)
 > $\mathrm{Tabulate}\left(n↦\mathrm{if}\left(n::\mathrm{even},"b","a"\right),100\right)$
 ${"abababababababababababababababababababababababababababababababababababababababababababababababababab"}$ (2)
 > $\mathrm{Tabulate}\left(n↦\mathrm{Char}\left(n+\mathrm{Ord}\left("a"\right)-1\right),26\right)$
 ${"abcdefghijklmnopqrstuvwxyz"}$ (3)
 > $\mathrm{Tabulate}\left(n↦\mathrm{if}\left(n::\mathrm{prime},"*","."\right),2000\right)$
 ${".**.*.*...*.*...*.*...*.....*.*.....*...*.*...*.....*.....*.*.....*...*.*.....*...*.....*.......*...*.*...*.*...*.............*...*.....*.*.........*.*.....*.....*...*.....*.....*.*.........*.*...*.*...........*...........*...*.*...*.....*.*.........*.....*.....*.....*.*.....*...*.*.........*.............*...*.*...*.............*.....*.........*.*...*.....*.......*.....*.....*...*.....*.......*...*.......*.........*.*.........*.*.....*...*.....*.......*...*.*...*...........*.......*...*.......*...*.....*...........*.*.................*.....*.........*.....*.....*.*.....*.........*.....*.....*.*.....*.....*...*.*...........*.........*.*...*.....*.....*.*...........*...*.....*.......*.........*.......*.........*.......*.....*.....*...*.......*.....*...*.......*...*.............*.........*...........*.*.........*.*...*.*.........*.............*...*.*...*.............*...*.*...*...................*...*.......*.........*.......*...*.....*.....*.............*...*.....*.....*.......*.....*...........*...*.....*.*.........*.*.....*.........*.*.........*.*.....*.................*...*.*...*.....*.....*.......*.....*.....*.....................*.*.........*.......*.........*.....*.....*.......*...........*...*.....*.....*.*.....*...........*.........*.................*.*...*.....*.*.....*...*.*...*...........*.*.....*.................................*.....*.....*.......*.................*.........*.............*...*.*...*.....*.......*...*.*.....*...........*.........*.*...*.*...*.....*...........*...........*.......*...........*.....*...*.....*.......*...*.......*...*.............*...*.....*.*...*.....*.*.....*.........*...................*.....*...*.*.......................*...*.*.........*...........*.*.........*.......*.....*.....*.....*.................*.....*...*.*...........*.........*...........*.......*...............*.............*.....*...*.*...*.*.........*...........*.....*.....*.................*.*...............*.*.....................*.....*.......*.....*...*.*."}$ (4)