Hi, For programs that need to use "vectors whose length can change" grow vectors are often the right choice:
http://docs.racket-lang.org/data/gvector.html /Jens Axel 2015-08-02 12:54 GMT+02:00 mazert <[email protected]>: > 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. > -- -- Jens Axel Søgaard -- 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/CABefVgzf4%3DMrBYxodD_iHHmM7ftDnaM1YqZ%3DOz1S5Bd1G_fFxg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
