How to construct pure expressions

*To*: mathgroup at christensen.cybernetics.net*Subject*: [mg631] How to construct pure expressions*From*: Xah Y Lee <xyl10060 at fhda.edu>*Date*: Sun, 2 Apr 1995 21:08:39 -0700 (PDT)

How to write a function ExprGenerator[] such that, for example ExprGenerator[x,{3,3,3,3}] will return x[ x1[ x11[ x111[ x1111, x1112, x1113], x112[ x1121, x1122, x1123], x113[ x1131, x1132, x1133] ], x12[ x121[ x1211, x1212, x1213], x122[ x1221, x1222, x1223], x123[ x1231, x1232, x1233] ], x13[ x131[ x1311, x1312, x1313], x132[ x1321, x1322, x1323], x133[ x1331, x1332, x1333] ] ], x2[ x21[ x211[ x2111, x2112, x2113], x212[ x2121, x2122, x2123], x213[ x2131, x2132, x2133] ], x22[ x221[ x2211, x2212, x2213], x222[ x2221, x2222, x2223], x223[ x2231, x2232, x2233] ], x23[ x231[ x2311, x2312, x2313], x232[ x2321, x2322, x2323], x233[ x2331, x2332, x2333] ] ] ]; In general, the list will have following properties: * All expressions has a head that starts with the letter x. * The number after x correspond to the position list of that element. For example, x211 is an element with position {2,1,1}. * The number of digits following x correspond to the level of that element. For example, x111, x211 are elements in level 3, x1 or x2 is in level 1, x is in level 0 because it has zero digits following x. I spend 2 hours on this with no clear solution. But, one learns a lot about mma structures and commands that manipulate them. Xah Lee Venus & Xah Love Factory Quote of the day: To understand infinity, you need to know love. --Venus.