label.multiply

This function is overloaded, it supports these signatures:

  • label.multiply(l)

    The product (i.e., the concatenation) of two labels: a.multiply(b) => ab.

  • label.multiply(num)

    The repeated multiplication (concatenation) of an label with itself: a.multiply(3) => aaa.

Precondition:

  • num must be nonnegative.

Examples

In [1]:
import vcsn
label = vcsn.context('law_char, q').label

Simple Multiplication

Instead of a.multiply(b), you may write a * b.

In [2]:
label('ab') * label('cd')
Out[2]:
$\mathit{abcd}$
In [3]:
label('ab').multiply(label('cd'))
Out[3]:
$\mathit{abcd}$
In [4]:
label('ab') * label(r'\e')
Out[4]:
$\mathit{ab}$

Repeated Multiplication

Instead of a.multiply(3), you may write a ** 3.

In [5]:
label('ab') ** 0
Out[5]:
$\varepsilon$
In [6]:
label('ab') ** 1
Out[6]:
$\mathit{ab}$
In [7]:
label('ab') ** 3
Out[7]:
$\mathit{ababab}$