Metaprogramming maths