~statianzo/sevenlangs

sevenlangs/io/matrix.io -rw-r--r-- 380 bytes
2fcd4511Jason Staten day one logic style 2 years ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Matrix := Object clone do(
  store ::= nil
  get := method(x, y,
    store at(x) at(y)
  )

  set := method(x, y, value,
    store at(x) atPut(y, value)
  )

  dim := method(x, y,
    list setSize(x) map(list setSize(y))

    Matrix clone setStore(
     list setSize(x) map(list setSize(y))
    )
  )
)

m := Matrix dim(10, 7)
m set(3,4, 5)
m get(3,4) println
m get(3,0) println