|
|
1.1 root 1: functor Spreadsheet(P : PARSE) : SPREADSHEET =
2: struct
3:
4: structure F = P.F
5:
6: fun array2(i,j,v) =
7: let fun init 0 = nil | init i = array(j,v) :: init(i-1)
8: in arrayoflist(init i)
9: end
10: fun update2(a,i,j,v) = update(a sub i, j, v)
11:
12: val dim = 10
13:
14: val vtable = array2(dim,dim,0)
15: val ftable = array2(dim,dim,F.eval(P.parse "0"))
16: val stable = array2(dim,dim,"0")
17:
18: fun set(i,j,s) = (update2(ftable,i,j, F.eval(P.parse s));
19: update2(stable,i,j,s))
20:
21: fun for (i,j) f = if i<=j then (f i; for(i+1,j) f) else ()
22:
23: fun eval() = for(0, dim-1)
24: (fn i => for(0, dim-1)
25: (fn j => update2(vtable,i,j,
26: (ftable sub i sub j) vtable)));
27:
28: fun get(i,j) = (stable sub i sub j, vtable sub i sub j)
29: end
30:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.