Question: Function to parse expression

Hi, I want to write a function to parse an expression into coefficients and exponents as follows:

> parseTerms(2*a^x*b^y*c^z, [a, b, c]) = [2, [[a, x], [b, y], [c, z]]]
> parseTerms(3*u*a^2*b^3*c^(m+1)*d^t, [a, b, c, d]) = [3*u, [[a, 2], [b, 3], [d, t], [c, m+1]]]


I found a similar function (factors), but it fails in the second case.

Please Wait...