If we rearrange this so that all assignments are on the left hand side
(and only one assignment per line), we can quickly see that A and H
are the same value, and that I is 50+B, that J and C are very similar,
and that the remainder of the assignments are all about formatting
these results (and, also, that this "almost the same sort of thing"
continues on down the line).
One simplification would be to re-use the variables (why have H? why
not just use A there?)
Another would be to define a reusable routine and to use it twice.
Another would be to define most of these things once (BI=: 0.1*i.100)
and then split things up when formatting. (But you still would need to
do the same formatting twice, which pushes more in the direction of
using a routine.)
Probably any of these approaches should be guided by comments or clues
for identifying the purpose for each of these names.
So... for example, here's using a routine:
tblpage=:3 :0
colarg=. 0.01*i.10
rowarg=. y+0.1*i.50
tbldat=. 10^.rowarg +/ colarg
(('<10^.');":,.rowarg),.(8j2":colarg);8j4":tbldat
)
G-:tblpage 0
1
N-:tblpage 5
1
That said, I'd be tempted to make some minor changes. Maybe something like this:
tblpage=:3 :0
colarg=. 0.01*i.10
rowarg=. y+0.1*i.50
tbldat=. 10^.rowarg +/ colarg
(('10^.x+y');,.rowarg),.(8j2":colarg);8j4":tbldat
)
(tblpage 0),:tblpage 5
Or, if we can graduate from simple J:
0 ,:&tblpage 5
Anyways, a variety of options here...
Thanks,
--
Raul
On Wed, Oct 4, 2017 at 12:03 PM, Linda Alvord <[email protected]> wrote:
> Here's a way to create the 2 pages found in most high school Algebra 2
> texts.
>
> NB. log tables.ijs
> D=:8j4":10^.C=:(B=:0.1*i.50)+/A=:0.01*i.10
> E=:(<8j2":A),:<D
> F=:,.('<10^.');<":,.B
> G=:F,.E
> K=:8j4":10^.J=:(I=:0.1*50+i.50)+/H=:0.01*i.10
> L=:(<8j2":A),:<K
> M=:,.('<10^.');<":,.I
> N=:M,.L
> G,:N
>
> Simplifications in simple J are great
>
> Linda
>
> Sent from AOL Mobile Mail
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm