Hello,

I have two functions I often use to remove an element from a vector, and it will be nice to add it directly in the vector module, or in the worst case into a specific package. Cause I'm sure it will be useful and we already have such functions for list, but not for vector...

; Remove the ith element of vector v
(define (vector-pop i v)
  (vector-append (vector-copy v 0 i) (vector-copy v (+ i 1))))

; Like remove (from list) but for a vector
(define (vector-remove ele v)
  (vector-filter-not (λ (x) (equal? x ele)) v))


Of course we have to use the check-vector/index to raise an error if "i" is out of range (see vector.rkt).


--
You received this message because you are subscribed to the Google Groups "Racket 
Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-dev/mpkst6%24koq%241%40ger.gmane.org.
For more options, visit https://groups.google.com/d/optout.

Reply via email to