> (define x (build-vector 4 (const (vector 1)))) > (vector-set! (vector-ref x 2) 0 5)
> x '#(#(5) #(5) #(5) #(5)) -------- vs. -------------- > (define x (build-vector 4 (λ (x) (vector 1)))) > (vector-set! (vector-ref x 2) 0 5) > x '#(#(1) #(1) #(5) #(1)) --------------------------------------------------------------- Maybe I'm misunderstanding const, but to me it means "ignore arguments" as opposed to signifying shared-structure / immutability (like a "constant"). That's what #(1) is for. The top version should I believe constantly return a fresh (different) vector regardless of its arguments. I'm on 5.3.4 due to Ubuntu, in case this was already found.
____________________ Racket Users list: http://lists.racket-lang.org/users