\: and /: in k are special cases of J rank.

In k, x f\: y (each left) applies f between each item of x and the entire
of y, e.g.


k)a:1 2

k)b:10 20 30

k)a +\: b

11 21 31

12 22 32


The J equivalent would be to apply f with rank _1 _, i.e.


   a=: 1 2

   b=: 10 20 30

   a +"_1 _ b

11 21 31

12 22 32


In J, this is the same as +/ i.e.


   a +/ b

11 21 31

12 22 32


 Also, the J equivalent of $!4 would be:


   ":each i.4

┌─┬─┬─┬─┐

│0│1│2│3│

└─┴─┴─┴─┘


To join 'm' to each:


   'm' ,each ":each i.4

┌──┬──┬──┬──┐

│m0│m1│m2│m3│

└──┴──┴──┴──┘


or simply:


   ('m',":)each i.4

┌──┬──┬──┬──┐

│m0│m1│m2│m3│

└──┴──┴──┴──┘


On Sat, Feb 8, 2014 at 5:46 AM, Christopher A. Simon <
[email protected]> wrote:

> My apologies if this is not where newbies email with questions.
>
> I've become somewhat comfortable with k, in particular
>
> ' \: and /:
>
> But I haven't exactly found how to do similar operations j.
>
> I'm a little lost with, find the equivalent to,
>
> ("m",)'$!4
>
> Any suggestions for transitioning from k to j, with respect to ' , \: and
> /:
>
> Thanks,
>
> -Chris
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to