functional programming - Mutate vector in scheme by appending vectors -


i don't know underlying implementation of vectors in scheme, hence not sure how write vector-append!

prototype:

(define (vector-append! vect . vects)   ; definition here    ) 

p.s. preferred use vector on list since vector-ref constant time operation [src]

you can't resize vector after creation, vector-append! can not implemented in-place operation. can do, create new vector size equal sum of subvectors' sizes, elements in subvectors copied 1 after other.

use vector-grow starting procedure, , work there. you'll have play bit indexes working solution.


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -