fork(3) download
  1. main = interact f
  2.  
  3. p(x:r)|(a,b)<-p r=case x of '('->("(\\x->"++a++(fst(p b)),"");'.'->('(':a++")",b);')'->(" x)",r);_->(x:a,b)
  4. p _=("","")
  5. f s=fst(p('(':s++")"))
Success #stdin #stdout 0s 4720KB
stdin
a.b(c.d)e.f g(h)(i j.k).l(m(n.o).p)
stdout
(\x->a(b(\x->c(d x))e(f g(\x->h x)(\x->i j(k x))(l(\x->m(\x->n(o x))(p x)))))