One reason for getting error is xyz
is undefined. You meant to use xyzq
, I think.
From your description, it's not clear to me what is your expected output.
Can you please provide a REPRoducible EXample of your problem, mentioning a expected output for a small input?
I failed to find any factor
in your example. If you just want to reverse a vector, you may use the rev
function.