But if I want to do XOR, AND or some other bitwise function on (#: 3 ) and (#: 14) how would I do that? I know I can use m b. with 3 and 14, but in the case of doing things bitwise I really need the shorter array to be padded at the front otherwise 3 becomes (in my original case) 1 1 0 0 = 12 This makes doing any bitwise functions very difficult.
> From: [email protected] > To: [email protected] > Date: Tue, 20 Jan 2015 09:09:49 -0500 > Subject: Re: [Jprogramming] Using ,: to prepend bits > > Jon, I try to keep data and functions separate. Your example is about > specific funcgions and data. > > (#:3) > 1 1 > #:14 > 1 1 1 0 > > (#:3),:#:14 > 1 1 0 0 > 1 1 1 0 > > g is a constant with shape 4, so g is "filled" to form the array. > > Linda > > -----Original Message----- > From: [email protected] > [mailto:[email protected]] On Behalf Of Jon Hough > Sent: Tuesday, January 20, 2015 8:55 AM > To: [email protected] > Subject: [Jprogramming] Using ,: to prepend bits > > This is a little problem I'm having. > > Let > f =: #: 3 > g =: #: 14 > > If I do f ,: g > > I get > > 1 0 0 0 > 1 1 1 0 > > Here the shorter number , f, has a zero post-pended to match the shape of g. > I would like to find an equivalent verb that prepends the zero. > i.e. , in the case of the above f and g > > f some_verb g > gives > 0 1 0 0 > 1 1 1 0 > > Any help appreciated. > > Jon > > > ---------------------------------------------------------------------- > 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
