[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: collection classes



At  6:12 PM 12/4/92 +0100, Jonathan Bachrach wrote:
> I've implemented the collection classes and have the following wish list:
> 
> NEW <SEQUENCE> GENERIC-FUNCTION'S
> 
>  The following function seems indispensible to me:
> 
>  (define-generic-function position (sequence element #key test count))

(define-method position ((s <sequence>) (e <object>) #key (test id?)
                                                          (count 0))
  (find-key s (curry test e) skip: count))


>  I suggest adding the following function to the offered set functions:
> 
>  (define-generic-function difference (sequence1 sequence2 #key test)) 
> 
>  The following insertion function's are very useful for many sequences classes
>  (like gap-list's).  It is difficult to write many of the sequence methods 
>  because `add' does not specify where the new-element is inserted.
> 
>  (define-generic-function insert (sequence new-element insertion-position))
>  (define-generic-function insert! (mutable-sequence new-element insertion-position))
>  (define-generic-function insert-sequence 
>      (sequence insertion-sequence insertion-position))
>  (define-generic-function insert-sequence!
>      (mutable-sequence insertion-sequence insertion-position))
> 
> DESTRUCTIVE <MUTABLE-SEQUENCE> FUNCTIONS
> 
>   It seems crucial to be able to destructively concatenate sequences:
> 
>   (define-generic-function concatenate! (mutable-sequence #rest rest-sequences))
> 
>   I would also like to see the following destructively functions added:
> 
>   (define-generic-function choose! (predicate mutable-sequence))
>   (define-generic-function choose-by! (predicate test-sequence mutable-value-sequence))
> 
> NEW SETTER
> 
>   There seems no reason to me why a setter was not provided for `last':
> 
>   (define-generic-function (setter last) (new-value mutable-sequence)) 
> 
> NEW INIT-KEYWORD FOR <TABLE>
> 
>   I would like to see <table> take `test:' as an init-keyword:
> 
>   (make <table> #key (test =))

I think all the rest of these are pretty reasonable, though I worry a bit about
library bloat.