Reversible polymerization driven by folding