Composition Calculus by recursive

R=str.replace
while 1:
 p=tuple(raw_input()[::2])
 while'0'>p[0]:
\x09p=(p[1],p[2:4])+p[4:]
\x09while~-hasattr(p[0],'join'):p=p[0]+p[1:]
 while p[2:]:p=(p[:2],)+p[2:]
 print R(R(R(`p`,"'",""),",",""),"((. 2) 3) 4","2 (3 4)")

Note that non-ascii characters in the above source code will be escaped (such as \x9f).

download

return to the top page