On Tue, Mar 2, 2010 at 11:27 AM, Tobias C. Rittweiler tcr@freebits.de wrote:
Alessio Stalla alessiostalla@gmail.com writes:
Greetings everyone,
I'm happy to announce that I have a preliminary version of user-extensible sequences working on ABCL, following the protocol proposed and implemented by Christophe Rhodes on SBCL ("User-extensible sequences in Common Lisp", http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.65.1604&rep=rep...). This includes:
- the possibility for the user to write subclasses of CL:SEQUENCE
- all functions operating on sequences have a corresponding generic
function in the SEQUENCE package that is called on user-defined sequence types, and for which the user can write methods to implement his/her custom sequences
- make-sequence works with user-defined sequences (using
sequence:make-sequence-like as in SBCL)
- mop::class-prototype has been added (as a tiny wrapper around
mop::allocate-instance)
- iterating over user-defined sequences integrated with LOOP
(untested, but should work as our loop implementation is derived from CMUCL like SBCL's)
- MAP and MAP-INTO should work unchanged
limitations/things missing wrt. SBCL (that I know of):
- no integration with DOSEQUENCE
I have spent some time on thinking about a good middle layer on top of sequences and what I came up with so far is at
http://common-lisp.net/project/sequence-iterators/
It's supposed to hook into extensible sequences where available though I haven't come around of doing so for sbcl.
So if you're looking for a mid layer, I think cloning those interfaces might make sense.
Looks very interesting, thanks. Especially the with-sequence-iterator macro, which is higher-level than SBCL's and more user-friendly (a SBCL sequence iterator is something like 3 objects + 6 functions). So, I will certainly clone those interfaces, and maybe even steal some code ;)
Alessio