expression.rweight(weight)

The right scalar product of an expression by a weight.

See also:

Examples

In [1]:
import vcsn
c = vcsn.context('lal_char, q')
In [2]:
e = c.expression('<2>a<3>bc', 'trivial')
e
Out[2]:
$ \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)$
In [3]:
e.rweight(c.weight('4'))
Out[3]:
$\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle $

Instead of e.rweight(w), you may write e * w.

In [4]:
e * c.weight('4')
Out[4]:
$\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle $

You may even run the simpler:

In [5]:
e * 4
Out[5]:
$\left( \left\langle 2 \right\rangle \,a \, \left( \left\langle 3 \right\rangle \,b \, c\right)\right)\, \left\langle 4 \right\rangle $