I haven't read the responses to this yet but I'm sure someone has explained the 
difference.

In short, @ is an assembly line, items being passed between workers one at a 
time, and @: is a hopper, all items being passed between workers in a batch.

Quick'n easy ruke of thumb: always use @: except when you specifically want the 
behavior of @ .  The former is a lot more common than the latter, and if you 
follow this rule, those rare occasions for @ will really stand out.


-Dan


Please excuse typos; composed on a handheld device.

-----Original Message-----
From: Bo Jacoby <[email protected]>
Sender: [email protected]
Date: Sat, 25 Jun 2011 15:37:47 
To: Programming forum<[email protected]>
Reply-To: Programming forum <[email protected]>
Subject: Re: [Jprogramming] Tacit  @ or @:  ??

Please. I don't understand the rank stuff. 

   f1 6 f2@f3@f4@f5 7 14 NB. This gives the result I want.
2 4
1 1

   6 f1@f2@f3@f4@f5 7 14 NB. but not this
  2  2.83
0.5 0.354

   6 f1@:f2@f3@f4@f5 7 14 NB. this is correct. 
2 4
1 1

WHY is @: needed here and not everywhere?

   6 f1@(f2@f3@f4@f5) 7 14 NB. This works
2 4
1 1

   6 f1@(f2@f3)@f4@f5 7 14 NB. and this
2 4
1 1


The following definitions and explanations should not be necessary in order to 
understand the problem, but just in case they are: The verb f5 is a dyad while 
f4 f3 f2 and f1 are monads. f4 and f3 are hooks. f5 and f1 are forks.f2 is a 
gerund.

   f5 
1 , ,:
   6 f5 7 14
1  1
6  6
7 14

   f4 
% +/@{:
   f4 6 f5 7 14
0.0476 0.0476
 0.286  0.286
 0.333  0.667

   f3
,: -.
   f3 f4 6 f5 7 14
0.0476 0.0476
 0.286  0.286
 0.333  0.667

 0.952  0.952
 0.714  0.714
 0.667  0.333

   f2
%~`*`:3"2
   f2 f3 f4 6 f5 7 14
  2    4
0.5 0.25

   f1
}: , %:@*/
   f1 f2 f3 f4 6 f5 7 14
2 4
1 1
----------------------------------------------------------------------
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