I have made some changes in s-serialization that allows improper-lists, for example cons-pairs and circular lists. They used to fail with a type-error.
I have made the changes inside the method for sequences rather than an another method specialised on lists. That way a proper list is output as a sequence (which is prettier), and an improper list is output as a list of cons-pairs.
Circular lists are handled by first making a fresh cons in the hash-table of deserialized objects, and then replacing its cdr with a reference to the first cons in the circular list, which is also stored in the hash-table.
Some new simple tests have also been added.
The source files are attached, and a diff against the latest version in CVS.
I have only tested this on x86 SBCL, but it should work on all implementations.
Best wishes, Henrik Hjelte
Hi Henrik,
On 27 Jan 2006, at 12:29, Henrik Hjelte wrote:
I have made some changes in s-serialization that allows improper- lists, for example cons-pairs and circular lists. They used to fail with a type-error.
I have made the changes inside the method for sequences rather than an another method specialised on lists. That way a proper list is output as a sequence (which is prettier), and an improper list is output as a list of cons-pairs.
Circular lists are handled by first making a fresh cons in the hash-table of deserialized objects, and then replacing its cdr with a reference to the first cons in the circular list, which is also stored in the hash-table.
Some new simple tests have also been added.
The source files are attached, and a diff against the latest version in CVS.
I have only tested this on x86 SBCL, but it should work on all implementations.
Your code looks very good; as far as I can see, it works well (I tested on LWM). I applied your changes and checked them in against cvs head. Thanks a lot for your contributions,
Sven
-- Sven Van Caekenberghe - http://homepage.mac.com/svc Beta Nine - software engineering - http://www.beta9.be
"Lisp isn't a language, it's a building material." - Alan Kay
cl-prevalence-devel@common-lisp.net