I am trying to define a function which recursively computes a polynomial associated to every binary string:
ComputePoly[s_]:=(** Recurse on the string s**)
For example, suppose my initial conditions were the following:
ComputePoly[""]:=1;
ComputePoly["0"]:=x_1;
ComputePoly["1"]:=x_2;
And suppose my recurrence relation was:
ComputePoly[u concatenated with v]:=ComputePoly[u]*ComputePoly[v]
Then this would describe a homomorphism from the monoid of binary strings to the multiplicative monoid of a polynomial ring in $x_1,x_2$.
How would I implement something like this? Should I even use strings, or is there a better data structure for working with binary sequences?