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 - to use extensible sequences you must explicitly (require :extensible-sequences) in advance - much less attention to precise sequence type information (but probably my patch doesn't improve nor worsen the situation before it)
the patch doesn't seem to break any new ANSI tests; however I've tested the extensible sequences proper very lightly, and I don't consider the patch ready for trunk yet. My long-term goal is to use the new extensible sequences support to make Java collections be Lisp sequences. That should include Clojure collections as well, since afaik they implement the Collection API.
If anyone has comments or critiques, or wants to help, you're welcome.
Cheers, Alessio
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.
-T.
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
On Tue, Mar 2, 2010 at 12:31 AM, Alessio Stalla alessiostalla@gmail.com wrote:
Greetings everyone,
I'm happy to announce that I have a preliminary version of user-extensible sequences working on ABCL [...]
limitations/things missing wrt. SBCL (that I know of):
I found a bug in my previous patch: (SETF ELT) was not correctly redefined to support extensible sequences. The revised patch is attached. I've also started to implement Java collections as sequences and things seems to go quite smoothly (but I'm just at the beginning).
Alessio
armedbear-devel@common-lisp.net