Checking if a polynomial is irreducible: list of factors?



Hi,

I'm experimenting with some programs to perform computations in finite
fields; one thing I need to do is to determine if a polynomial is
irreducible.  An easy way to do this would be to count the number of factors
returned with the "factor" command, but I don't know how to do this; "args"
works differently in each case.  For example:

(%i1) args(factor(x^2-1));
(%o1) [x-1,x+1]
(%i2) args(factor(x^2+1));
(%o2) [x^2,1]

Is there any way of turning the output of "factor" into a list of factors?

Thanks,
Alasdair