I think you can concentrate on just the behavior of f1@(:)f2 because
they are executed first as you can see from the following.

   9!:3]2 6

   f1@:f2@f3@f4@f5
+------------------------+-+--+
|+-----------------+-+--+|@|f5|
||+----------+-+--+|@|f4|| |  |
|||+--+--+--+|@|f3|| |  || |  |
||||f1|@:|f2|| |  || |  || |  |
|||+--+--+--+| |  || |  || |  |
||+----------+-+--+| |  || |  |
|+-----------------+-+--+| |  |
+------------------------+-+--+
(((f1@:f2)@f3)@f4)@f5

So look at just that part and you are likely to learn the difference.


On Sat, Jun 25, 2011 at 10:37 AM, Bo Jacoby <[email protected]> wrote:
> 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
>



-- 
(B=) <-----my sig
Brian Schott
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to