Re: [Jprogramming] Iversonizing formulas

2015-10-07 Thread John Baker
Handy On Tue, Oct 6, 2015 at 6:15 PM, Kip Murray wrote: > This is what I wanted to send. --Kip Murray > > NB. A way to do column operations > > NB. rop below makes row 2 become cumulative total of row 1 > > rop =: (2 {. ]),([: +/\ 1 { ]), 3 }. ] > > NB. cop below makes col 2 become cumulative to

Re: [Jprogramming] Iversonizing formulas

2015-10-06 Thread Kip Murray
This is what I wanted to send. --Kip Murray NB. A way to do column operations NB. rop below makes row 2 become cumulative total of row 1 rop =: (2 {. ]),([: +/\ 1 { ]), 3 }. ] NB. cop below makes col 2 become cumulative total of col 1 cop =: rop&.|: NB. Example ]sheet =: i. 5 4 0 1 2 3 4 5 6

Re: [Jprogramming] Iversonizing formulas

2015-10-06 Thread Kip Murray
Apologies for the mess below -- ill-behaving mailer! --Kip Murray On Tue, Oct 6, 2015 at 6:05 PM Kip Murray wrote: >NB. A > way to do column operations > NB. rop > below makes row 2 become cumulative total of row 1 > rop =: > (2 {. ]),([: +/\ 1 { ]), 3 }. ] > NB. cop > below make

Re: [Jprogramming] Iversonizing formulas

2015-10-06 Thread Kip Murray
NB. A way to do column operations NB. rop below makes row 2 become cumulative total of row 1 rop =: (2 {. ]),([: +/\ 1 { ]), 3 }. ] NB. cop below makes col 2 become cumulative total of col 1 cop =: rop&.|: NB. Example ]sheet =: i. 5 4 0 1 2 3 4 5 6 7 8 9 10 1112 1

Re: [Jprogramming] Iversonizing formulas

2015-10-06 Thread John Baker
Not at all. I often transpose but in this case the table has less than 1000 rows so it's not a large amount of data. Sent from my iPhone > On Oct 6, 2015, at 5:14 PM, Raul Miller wrote: > > Rather than using a rank 1 operation, I'd prefer to use a > column-at-a-time approach (in other words:

Re: [Jprogramming] Iversonizing formulas

2015-10-06 Thread Raul Miller
Rather than using a rank 1 operation, I'd prefer to use a column-at-a-time approach (in other words: transpose the table before working on it). I think that performance should be better, and the expressions are easier (in my opinion) to create. Ndx=: 3 :0"0 {. y&{::`'' ) ColNdxs=: 3 :0 #('`'

[Jprogramming] Iversonizing formulas

2015-10-06 Thread John Baker
The other day I was converting spreadsheet formulas that applied between columns to J operations on numeric tables. One such formula was: ((I - E) + R) - D Where the verbs -,+ work on columns. To convert this to a simple J expression you can "Iversonize". D -~ R + E -~ I which leads directly t