Prechádzať zdrojové kódy

SS compiler80 percent

Will 4 mesiacov pred
rodič
commit
0790786819
2 zmenil súbory, kde vykonal 30 pridanie a 17 odobranie
  1. 24 13
      SS.k
  2. 6 4
      excelpm.k

+ 24 - 13
SS.k

@@ -22,7 +22,6 @@ gi: {[r;c;rb;cb]
 };
 
 // decode excel formula
-// fill these ==========
 mc: {[c;i]
  i: gi[(#table);i+1;0;c];
  :i
@@ -32,7 +31,6 @@ mr: {[r;i]
  i: gi[i+1;(#table[0]);r;0];
  :i
 };
-// =====================
 
 drr: {[s;e]
  r: $[s[0]<0;mc[s[1];(e[1]-s[1])];mr[s[0];(e[0]-s[0])]];
@@ -75,17 +73,22 @@ de:{[idx;cell]
  ci: cell[0];
  cell: cell[1];
  idx: (*idx);
- f: slice[cell;idx[0];idx[1]];
 
+ f: slice[cell;idx[0];idx[1]];
  l: slice[cell;0;idx[0]];
  r: slice[cell;idx[1];#cell];
+ u.ppr (l;r);
+ u.ppr table[ci[0];ci[1]];
 
  (fl;fr): lr[f];
- deps[ci[0];ci[1]]:: (1;1);
+ r: dr[fl;fr];
 
- u.ppr "de: ", f;
- u.ppr (fl;fr);
- u.ppr'deps;
+ i: (ci[0]*3) + ci[1];
+ {
+  i:(*y);
+  i: (i[0]*3)+i[1];
+  deps[x;i]: 1;
+ }[(ci[0]*3)+ci[1];]'r;
 };
 
 /:parseidx["[1;2]"];
@@ -98,24 +101,32 @@ sectionkeys: (tstkey;cstkey;astkey);
 
 lines: {x,"\n",y}/(0: "SS.csv");
 table:: csv.csv[lines];
-deps:: (#table;#table[0])#0;
+d: (#table)*(#table[0]);
+deps:: (d;d)#0;
 
 / excel patterns
-pats: pat.run''table;
+:pats: pat.run''table;
 
 u.ppr'table;
 / u.ppr'pats;
 
 // start with last to maintain prior index accuracy
 lasts:{:((#x[0])-1)_x[0]}''pats;
+firsts:{:$[(#x[0])>1;((#x[0])-1)#x[0];0]}''pats;
 
 f: pats {
  :$[x[2]=5;y;0]
 }''lasts;
 
 ti: gi[#table;#table[0];0;0];
-table :ti {(,x),,y}''table;
+table::ti {(,x),,y}''table;
 
-/ table {
-/  :$[y~0;0;de[y;x]]
-/ }''f
+table {
+ :$[y~0;0;de[y;x]]
+}''f;
+
+table {
+ :$[y~0;0;de[y;x]]
+}''firsts;
+
+:deps

+ 6 - 4
excelpm.k

@@ -41,8 +41,10 @@ blk1: {[a;c]
  r: runS[c;s];
  r: *($[(+/r)>0;r^0;0]);
 
+ / u.ppr (c;r;a[2]);
+
  a0: $[s>4;s;r];
- :((,active);activeidx;1;a[3])
+ :((,active);activeidx;r;a[3])
 };
 
 // blk 2 stuff ===============================
@@ -75,7 +77,7 @@ blk2: {[a;c]
  r: runS[c;s];
  r: *($[(+/r)>0;r^0;0]);
 
- / u.ppr(c;r;a[2]);
+ / u.ppr (c;r;a[2]);
 
  edge: (s=((#states) - 1))&(r=0);
  a[3] +: 1;
@@ -95,6 +97,6 @@ run: {[str]
  :o
 };
 
-//            01234567890
-/ u.ppr (run["C1:C1-A1:A1"])
+//          012345678901
+/ u.ppr (run[" C1:C1-A1:A1"])
 \d .