I am trying to understand what f does.

   ]a=:?>:i.6
0 1 0 1 0 4
   ]a=:=a
1 0 1 0 1 0
0 1 0 1 0 0
0 0 0 0 0 1
   ]b=:?>:i.6
0 0 2 3 2 3
   f=: 13 :'x #@# y'
   a f b
3 2 1
   f
#@#
   
Raul's solution works.  However, I still can't figure out what has happened
to get the result that  both provide.

   NB.  ([: u v)"v
   j=: 13 :' x([:##)"# y'
   a j b 
3 2 1
   j
([: # #)"_ 1 _

Usually if I write an explicit definition without  @  I can figure out how
the result was obtained.

Both f and j have not yet made sense to me.

Linda   
 
-----Original Message----- 
From: [email protected]
[mailto:[email protected]] On Behalf Of Peter B.
Kessler
Sent: Wednesday, January 02, 2013 2:43 PM
To: [email protected]
Subject: Re: [Jprogramming] atop continues to puzzle me

Am I correct that in your example, you are using Open (>) just for its rank
(monadic 0), and not for its verb (the inverse of Box)?  That is

       < @ i. @ ]"0 ( 2 3 4 )
    +---+-----+-------+
    |0 1|0 1 2|0 1 2 3|
    +---+-----+-------+

would work as well.  (Parens around the argument are needed to separate it
from the Rank conjunction ("0).  I've also seen Same (]) used as a
separator.)  I think the point is that you want the Box Atop Integers (< @
i.) to operate on the atoms of its argument, not on the argument as a whole.

A more explicit way of saying you want a rank 0 verb is to use

       (< @ i.)"0 ( 2 3 4 )
    +---+-----+-------+
    |0 1|0 1 2|0 1 2 3|
    +---+-----+-------+

I find it confusing when I see Open used just for its rank.  (But I'm
learning. :-)  If my explanation is correct, maybe it will help someone else
learn this idiom.

                        ... peter    

Raul Miller wrote:
> Here's a definition for at which works exactly like @
> 
>    at=: 2 :'([: u v)"v
> 
> For example:'
>    <at i. at > 2 3 4
> 
> Now, looking at that, you may think that this means that [: is somehow 
> superior to @ but note that [: is not necessary
> 
>    at=: 2 :'u@:v"v'
> 
> Note that in J, @: and @ (without the colon) are different words.
> 
> It's also possible to replace @: with an explicit definition, but 
> that's probably best left for another time.
> 
> FYI,
> 
----------------------------------------------------------------------
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