I've lost track of the number of times I have tried to make dyadic ;: work.
I read it, understand it (I think), but I can't get it to work. The general
description has m, the input mapping as a list of boxes, each box
containing the items to be mapped to the same number. So, in an attempt to
figure out what is going on I converted the example in help to that form
and get an error.
Given sj, mj and y as defined in help:
(0;sj;mj) ;: y
+---+--+-+--+---+-+-+-+-+-+---+-+---+-+
|sum|=.|(|i.|3 4|)|+|/|.|*|0j4|+|pru|4|
+---+--+-+--+---+-+-+-+-+-+---+-+---+-+
So far, so good. Convert mj to the boxed form (display shortened to fit
e-mail):
mj2=:(/:~.mj){mj</.a.
,.50{.&.>mj2
+--------------------------------------------------+
| ┌┬┐├┼┤└┴┘│─!"#$%&()*+,-/;<=>?@|
+--------------------------------------------------+
| |
+--------------------------------------------------+
|ACDEFGHIJKLMOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz|
+--------------------------------------------------+
|N |
+--------------------------------------------------+
|B |
+--------------------------------------------------+
|0123456789_ |
+--------------------------------------------------+
|. |
+--------------------------------------------------+
|: |
+--------------------------------------------------+
|' |
+--------------------------------------------------+
Test it to see if it is ok.
my=. (y i.~;m) { (#m),~(#&>m)#i.#m NB. From help
y,:,":"0 my
sum=. (i.3 4)+/ .*0j4+pru 4
222061026515000160525022215
Looks good, but
(0;sj;mj2) ;: y
|length error
| (0;sj;mj2) ;:y
The problem is not with y, but something about mj2.
(0;sj;mj2)&;:
|length error
| (0;sj;mj2)&;:
As I understand the description in help, this should work.
So, what am I missing?
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm