Generate - Maple Help

StringTools

 Generate
 generate all strings of a given length on some alphabet

 Calling Sequence Generate( len, supp )

Parameters

 len - non-negative integer; length of the strings to generate supp - string; support string specifying the alphabet to use

Description

 • The Generate(len, supp) command generates a list consisting of all strings whose length is equal to len formed from the characters in the alphabet specified by the string supp. The string supp specifies the alphabet consisting of its distinct characters.
 • Note that the number length( supp )^len of strings generated grows exponentially. Thus, it is usually practical to specify modest size arguments when calling this procedure. In particular, if the alphabet has at least two characters, then the maximum value for the len parameter is 25.
 • 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):$
 > $\mathrm{Generate}\left(2,"ab"\right)$
 $\left[{"aa"}{,}{"ab"}{,}{"ba"}{,}{"bb"}\right]$ (1)
 > $\mathrm{Generate}\left(2,"ababababa"\right)$
 $\left[{"aa"}{,}{"ab"}{,}{"ba"}{,}{"bb"}\right]$ (2)
 > $\mathrm{Generate}\left(3,"ab"\right)$
 $\left[{"aaa"}{,}{"aab"}{,}{"aba"}{,}{"abb"}{,}{"baa"}{,}{"bab"}{,}{"bba"}{,}{"bbb"}\right]$ (3)
 > $\mathrm{Generate}\left(2,"xyz"\right)$
 $\left[{"xx"}{,}{"xy"}{,}{"xz"}{,}{"yx"}{,}{"yy"}{,}{"yz"}{,}{"zx"}{,}{"zy"}{,}{"zz"}\right]$ (4)
 > $\mathrm{numelems}\left(\mathrm{Generate}\left(10,"abc"\right)\right)$
 ${59049}$ (5)

This is not possible.

 > $\mathrm{Generate}\left(100,"abcde"\right)$