4 ms·
I don't quite understand what you mean by generic collections in this case. Do you want to restrict a list to only contain one specific type?
by Pay08 3mo ago
I don't quite understand what you mean by generic collections in this case. Do you want to restrict a list to only contain one specific type?
- Jtsummers 3mo agoI wrote that quickly and should have edited it for clarity. What I meant was a new collection type that could be treated as a sequence. https://www.lispworks.com/documentation/HyperSpec/Body/17_a.htm https://www.lispworks.com/documentation/HyperSpec/Body/17_a.... None of the functions operating on sequences are generic, so you cannot create your own type and do a `defmethod` and have them automatically adapt to it. And unlike `print-object` which gets used by format and print and others, there's also no "protocol" (or whatever term you like) generic function you can implement which will make your collection acceptable as a sequence. You could build something like this, and maybe shadow the standard functions so that it's not a new set of functions from a user perspective, but it's a notable absence in a language with a rich OO system through CLOS. It makes sense that it wasn't in the original spec, but I still think it would have been something that would have been added if the development of CL (as a standard) had continued.
- Pay08 3mo agoOh, I understand. For what it's worth, some implementations do have that as an extension, although I've personally never used it. See http://www.sbcl.org/manual/#Extensible-Sequences http://www.sbcl.org/manual/#Extensible-Sequences.