[Jprogramming] problem with under
Linda Alvord
lindaalvord at verizon.net
Sat Oct 29 15:09:34 HKT 2011
Remove either atop @ or at @: and you get:
(+/ *:) 3 4
12 19
13 20
but when you put in cap [: you get the result of @: rather than @
([:+/ *:) 3 4
25
Linda
-----Original Message-----
From: programming-bounces at jsoftware.com
[mailto:programming-bounces at jsoftware.com] On Behalf Of Kip Murray
Sent: Thursday, October 27, 2011 4:03 PM
To: Programming forum
Subject: Re: [Jprogramming] problem with under
I like especially your second form I =: ([: < [: /: ":)"0
For the third form I =: < @ /: @ ": " 0 note that [: f g and f @: g are
always equivalent, but f @: g and f @ g are not when g has rank 0 --
conjunction @: always uses sequential processing, but conjunction @ uses
parallel processing when g has rank 0, as shown below.
(+/ @: *:) 3 4
25
(+/ @ *:) 3 4
9 16
In the first case above the right to left flow chart is
25 <-- +/ <-- 9 16 <-- *: <-- 3 4 (sequential processing)
while in the case involving @ the flow chart is
<-- 9 <-- *: <-- 3
9 16 <-- +/ (parallel processing because *: is rank 0)
<-- 16 <-- *: <-- 4
As I nearly always want sequential processing I use
[: f [: g h (read "the f the g h")
or
f @: g @: h (read math's "f o g o h")
Check:
([: +/ *:) 3 4
25
On 10/27/2011 5:21 AM, Raul Miller wrote:
> Also, for the domain in question, we are not using> for anything but its
rank.
>
> Thus we could simplify:
>
> I =: ([:< [: /: [: ": ])"0
>
> Also, since we are always using this as a monad, we could further
simplify:
>
>
> I =: ([:< [: /: ":)"0
>
> Though, personally, I find myself comfortable using @
>
> I =:<@/:@":"0
>
> Or, going back to the original message, and applying @ to achieve what
> the dictionary was talking about:
>
> <@([: /: ":)@>a,b
>
> Or, using "0 to replace @>
>
> <@([: /: ":)"0 a,b
>
> But if you are using trains in boxes, maybe it's better to state that
> explicitly, and that could also get rid of any of the @ conjunctions:
>
> ([: /: ":) L:0<"0 a,b
>
> That said, when you replace a shorter expression with a longer one, I
> think you should expect the longer one to lose some of the grace of
> the original.
>
> I hope this helps.
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
More information about the Programming
mailing list