The `math/matrix` library aims at functional arrays, that is arrays that aren't mutated but are instead transformed into new arrays.
However, if you want mutable arrays, then you should probably use the `mutable-array` constructor to create them, and then `array-set!` will work. Sam On Sun, Oct 7, 2018 at 10:56 AM Ricardo Iglesias <ricardoa.igles...@gmail.com> wrote: >> >> >I think you want the `matrix-ref` function. > > While this does give me the value, I am unable to set it. > > Calling > (define M (matrix ([1 2 3] [4 5 6]))) > (set! (matrix-ref M 0 2) 5) > > Leads to the error: > ; .../Example.rkt:228:6: set!: not an identifier > > ----------------- > And array-set! for changing the value of an entry. > What would be the syntax for that? I noticed that a requirement for using > array-set! is that the array passed in needs to be a settable array, and that > the matrices in math/matrix are not such a type of array. > > I get this error: > array-set!: contract violation > ; expected: Settable-Array? > ; given: (array #[#[1 2 3]]) > ; in: the 1st argument of > ; (-> > ; (struct/c > ; Settable-Array > ; (vectorof Index) > > > > -- > You received this message because you are subscribed to the Google Groups > "Racket Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to racket-users+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "Racket Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.