Skip to content
Matthias Görges edited this page Jun 1, 2015 · 1 revision

#(listlist-set! m col row val) listlist-set! replaces a value in a matrix (list of lists).

Parameter Description
m Matrix (list of lists)
row Row number (0..n-1)
col Column number (0..n-1)
val Value to be set

Example

Example 1: Make a matrix, obtain a value, change a value and look at the result

> (define mat '((1 2 3) (4 5 6)))
> (listlist-ref mat 1 1)
5
> (listlist-set! mat 1 1 88)
((1 2 3) (4 88 6))
> mat
#[(listlist-ref m col row)](../blob/master/modules/ln_core/listlist.scm)

listlist-ref obtains a value from a matrix (list of lists).

Parameter Description
m Matrix (list of lists)
row Row number (0..n-1)
col Column number (0..n-1)

Example

Example 1: Make a matrix, obtain a value, change a value and look at the result

> (define mat '((1 2 3) (4 5 6)))
> (listlist-ref mat 1 1)
5
> (listlist-set! mat 1 1 88)
((1 2 3) (4 88 6))
Clone this wiki locally