Thanks. Your problem is the old 'x ; boxed y' error. (0;sj;<mj2) ;: y +---+--+-+--+---+-+-+-+-+-+---+-+---+-+ |sum|=.|(|i.|3 4|)|+|/|.|*|0j4|+|pru|4| +---+--+-+--+---+-+-+-+-+-+---+-+---+-+
Henry Rich On 2/24/2012 11:58 PM, Don Guinn wrote: > d332 for ;: in J Vocabulary. I didn't want to put all that in the mail, but > here it is. > > mj=: 256$0 NB. X other > mj=: 1 (9,a.i.' ')}mj NB. S space and tab > mj=: 2 ((a.i.'Aa')+/i.26)}mj NB. A A-Z a-z excluding N B > mj=: 3 (a.i.'N')}mj NB. N the letter N > mj=: 4 (a.i.'B')}mj NB. B the letter B > mj=: 5 (a.i.'0123456789_')}mj NB. 9 digits and _ > mj=: 6 (a.i.'.')}mj NB. D . > mj=: 7 (a.i.':')}mj NB. C : > mj=: 8 (a.i.'''')}mj NB. Q quote > > sj=: _2]\"1 }.".;._2 (0 : 0) > ' X S A N B 9 D C Q ']0 > 1 1 0 0 2 1 3 1 2 1 6 1 1 1 1 1 7 1 NB. 0 space > 1 2 0 3 2 2 3 2 2 2 6 2 1 0 1 0 7 2 NB. 1 other > 1 2 0 3 2 0 2 0 2 0 2 0 1 0 1 0 7 2 NB. 2 alp/num > 1 2 0 3 2 0 2 0 4 0 2 0 1 0 1 0 7 2 NB. 3 N > 1 2 0 3 2 0 2 0 2 0 2 0 5 0 1 0 7 2 NB. 4 NB > 9 0 9 0 9 0 9 0 9 0 9 0 1 0 1 0 9 0 NB. 5 NB. > 1 4 0 5 6 0 6 0 6 0 6 0 6 0 1 0 7 4 NB. 6 num > 7 0 7 0 7 0 7 0 7 0 7 0 7 0 7 0 8 0 NB. 7 ' > 1 2 0 3 2 2 3 2 2 2 6 2 1 2 1 2 7 0 NB. 8 '' > 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 9 0 NB. 9 comment > ) > > x=: 0;sj;mj > y=: 'sum=. (i.3 4)+/ .*0j4+pru 4' > > x ;: y > > On Fri, Feb 24, 2012 at 9:28 PM, Henry Rich<henryhr...@nc.rr.com> wrote: > >> Where is this help, where sj and mj are defined? >> >> Henry Rich >> >> On 2/24/2012 7:25 PM, Don Guinn wrote: >>> 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 >> ---------------------------------------------------------------------- >> For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm