Add test case for nested improper lists
Reimplement IO.ANSI do_format

This avoids copying partial lists, and handles nested improper lists.