On 2021-03-19 02:48, HH PackRat wrote:
[leny1 is the length of the DEG table and lenx1 is the length of the
table to match DEG with]
xydiff=. leny1 - lenx1 NB. length leny1 must always be longer than
lenx1
DEG2=. _xydiff {. DEG NB. save unmatched tail portion of DEG
DEG=. _xydiff }. DEG NB. delete unmatched tail portion of DEG
Since it seems (and I may be mistaken in some way) that J cannot
handle the value of a noun variable, how can I accomplish what I'm
trying to do in the above code?
The error you get is 'ill-formed number' on _xydiff
;: '_3 -3'
┌──┬─┬─┐
│_3│-│3│
└──┴─┴─┘
_3
_3
-3
_3
[n=:3
3
-n
_3
_n
|ill-formed number
| _n
| ^
_ is part of the notation for writing numbers, and isn't an
operator. You can get the result you want with -
[DEG=:i.4 3
0 1 2
3 4 5
6 7 8
9 10 11
[other=:i.3 3
0 1 2
3 4 5
6 7 8
[diff=:(#DEG) - #other
1
[DEG2=: (-diff) {. DEG
9 10 11
[DEG=: (-diff) }. DEG
0 1 2
3 4 5
6 7 8
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm