I think of @ as "parallel processing" and @: as "serial processing". Suppose
]a =: >: i. 2 3
1 2 3
4 5 6
In
2 *"1 a
2 4 6
8 10 12
2 is multiplied times each row of a and J assembles the resulting rows.
In
2 |.@(*"1) a
6 4 2
12 10 8
2 is multiplied times each row of a and ("parallel processing") each resulting
rows is passed to |. for reversal. J then assembles the reversed rows.
In
2 |.@:(*"1) a
8 10 12
2 4 6
("serial processing") the entire two-row result of 2 *"1 a is passed to |. for
reversal.
Kip Murray
Sent from my iPad
On Jan 3, 2013, at 1:55 AM, "Linda Alvord" <[email protected]> wrote:
> Try this script in J7 and you will notice what I saw:
>
> a #@# b is the same as +/"1 a and I still can't figure out what a #@# b
> does !
>
>
> load 'debug/dissect'
> ]a=:?>:i.6
> ]a=:=a
> ]b=:?>:i.6
> f=: 13 :'x #@# y'
> NB.u@v is ([: u v)"v
> j=: 13 :' x([:##)"# y'
> (a f b) -:a j b
> a ([:##) "1 b
> (a f b)-:a([:##)"1 b
> (a f b)-:+/"1 a
> ds 'a([:##)"1 b'
>
> Henry's ds made it obvious that there was another way to get the result.
>
> Linda
>
> -----Original Message-----
> From: [email protected]
> [mailto:[email protected]] On Behalf Of Linda Alvord
> Sent: Wednesday, January 02, 2013 6:38 PM
> To: [email protected]
> Subject: Re: [Jprogramming] atop continues to puzzle me
>
> 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
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm