I\'ve read this question before, and followed Eli Barzilay\'s answer on srfi-25.
Besides reading the source code of srfi-25, I found writing some auxiliary function woul
An alternative to using nested vectors for multidimensional vectors is to use the math library's array data structure.
Here's an example use:
Welcome to Racket v6.4.0.4.
-> (require math/array)
-> (define arr (mutable-array #[#[1 2 3] #[4 5 6]]))
-> (array-ref arr #(0 0))
1
-> (array-ref arr #(1 2))
6
-> (array-set! arr #(1 2) 15)
-> (array-ref arr #(1 2))
15
There is a caveat that this will be slower when you use the library from untyped code (e.g., #lang racket
). It will be fast when used in Typed Racket.