### Symbolic expressions in positive characteristic

Is there a way to work with symbolic expressions in positive characteristic? I know that the standard answer is to convert everything into polynomials ovef GF(p), however, this does not work when an expression features a custom function, say:

```
a, b = var('a, b')
foo = function('foo', nargs=1)
expr = 3 * a**3 + 5 * foo(b**2 + 2 * a)
```

What I really need is something similar to Maple's `expr mod p;`

, which reduces the expression `expr`

modulo `p`

. It cannot be implemented by a simple rewriting, because one cannot just replace every integer in an expression by its remainder mod p (mind the powers!).

I tried taking `R = SR.quotient_ring(SR.ideal(2))`

and using `R(expr)`

, but this does not seem to have any effect. Using `RingConverter`

was not a success either.

If this simplifies things, I do not need the reduction to work inside the function arguments, so simply reducing `3 * a**3 + 5 * foo(b**2 + 2 * a)`

to `a**3 + foo(b**2 + 2 * a)`

would suffice.