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 to the nice little verb (cops):

cops=:  -~`+`(-~)`:3"1

That will do all the operations on each row in one swoop.

The question arises. Given an arbitrary parenthesized formula with only
dyadic verbs as text:

'((A * B) + C) - ((F - G) * (Q + B))'

Return the  Iversonized gerund expression and the column permutation needed
to get an expression like (cops).

I've been doing this by hand but if anyone cares to dig into this and crank
out a solution if would help many of us that are punished by spreadsheets.

-- 
John D. Baker
[email protected]
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to