I have a list of strings consisting of sequences of "+" or "-"'s. For example, let's take the list
lst={"-+", "+-+", "--+", "++-+", "+--+", "---+"}
I also have four functions $f_- (a),f_+ (a),s_- (a),s_+ (a)$ that take as arguments lists of four elements $a=\{x,y,z,w\}$. The functions $s_\pm$ return a number, while the functions $f_\pm$ return another list $\{x',y',z',w'\}$.
I want to write a function that reads each item from lst
and creates iterated expressions of the form $$s_-(a) \, s_+ (f_- (a)),\\ s_+(a)\,s_- (f_+ (a))\,s_+(f_-(f_+(a))),\\ s_-(a)\,s_- (f_- (a))\,s_+(f_-(f_-(a))),\ldots$$ for the first three terms for example.
So it works like this: (i) for the first symbol it returns the $s$ function with the same subscript, (ii) for the second symbol it returns again the $s$ function of the same symbol but with argument the $f$ function with subscript of the previous symbol, (iii) for the third symbol it returns the $s$ function with the same subscript but with argument nested $f$ functions with subscripts matching the previous two symbol, (iv) .... The rule continues until we read all the symbols of the string.
Is there a relatively simple way to do this? Thanks!