StringTools - Maple Programming Help

Home : Support : Online Help : Programming : Names and Strings : StringTools Package : Constructors : StringTools/Tabulate

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.

Examples

 > $\mathrm{with}\left(\mathrm{StringTools}\right):$
 > $\mathrm{evalb}\left(\mathrm{Tabulate}\left(\mathrm{Char},200\right)=\mathrm{Ι}\left(1,200\right)\right)$
 ${\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)