I'm no longer puzzled:

    ]a=:?>:i.6
0 1 0 2 3 4
   ]a=:=a
1 0 1 0 0 0
0 1 0 0 0 0
0 0 0 1 0 0
0 0 0 0 1 0
0 0 0 0 0 1
   ]b=:?>:i.6
0 0 1 1 1 2
   a #@# b
2 1 1 1 1
   a ([:##)"# b
2 1 1 1 1
   g=: 13 :'x([:##)"# y'
   a g b
2 1 1 1 1
   5!:4 <'g'
              -- [:
      --------+- # 
-- " -+       L- # 
      L- _ 1 _     
   g
([: # #)"_ 1 _
   
 The comic footnote is what I found with  ds  from Henry Rich!

   +/"1 a 
2 1 1 1 1
   
Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Linda Alvord
Sent: Friday, January 04, 2013 9:10 AM
To: [email protected]
Subject: Re: [Jprogramming] atop continues to puzzle me

Wow!

 

   at=: 2 :'([: u v)"v'

   3 4 5 < at #"0 i.3

------T-------T---------┐
│0 0 0│1 1 1 1│2 2 2 2 2│
L-----+-------+----------

   3 4 5 ([:<"1#"0)">i.3

------T-------T---------┐
│0 0 0│1 1 1 1│2 2 2 2 2│
L-----+-------+----------

   f=: 13 :'([:<"1#"0)">y'

   3 4 5 f i.3

------T-------T---------┐
│0 0 0│1 1 1 1│2 2 2 2 2│
L-----+-------+----------

   f

([: <"1 #"0)"0 0 0

   5!:4 <'f'

              -- [:     
              │     -- <
              +- " -+- 1
      --------+         
      │       │     -- #
-- " -+       L- " -+- 0
      L- 0 0 0          

   

Graham, that is some pretty picture.

 

Linda

 

 

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Graham
Parkhouse
Sent: Friday, January 04, 2013 7:14 AM
To: [email protected]
Subject: Re: [Jprogramming] atop continues to puzzle me

 

 

> On Wed, Jan 2, 2013 at 10:04 AM, Raul Miller <
<mailto:[email protected]> [email protected]>

> wrote:

> > Here's a definition for at which works exactly like @

> >

> >    at=: 2 :'([: u v)"v

 

   at=: 2 :'([: u v)"v'

   3 4 5 < at #"0 i.3

+-----+-------+---------+

|0 0 0|1 1 1 1|2 2 2 2 2|

+-----+-------+---------+

 

Linda - we've done it! We've got rid of @!

 

But we used a conjunction to do it, so the same reasoning applies; we
avoided making J massage an intermediate result into something rectangular.

 

> Date: Thu, 3 Jan 2013 14:53:17 -0800

> From: Nollaig MacKenzie < <mailto:[email protected]>
[email protected]>

> To:  <mailto:[email protected]> [email protected]

> Subject: Re: [Jprogramming] Atop continues to puzzle me

> Message-ID: < <mailto:[email protected]>
[email protected]>

> Content-Type: text/plain; charset=us-ascii

> 

> ...

> 

> I thought there might be a way of getting a function without using

> composition by using "L:" . But the best I came up with was:

> 

>    f=. (# L: 0) & <"0

>    3 4 5 f i.3

> 

> +-----+-------+---------+

> |0 0 0|1 1 1 1|2 2 2 2 2|

> +-----+-------+---------+

> 

> But the "&" vitiates the attempt.

> 

> The general argument about J functions having to produce rectangular

> arrays should have convinced me anyway.

> 

> NM

> 

> --

> Nollaig MacKenzie

>  <http://www.yorku.ca/nollaig> http://www.yorku.ca/nollaig

 

Linda, I think this 'general argument about J functions having to produce
rectangular arrays' should help you see why there are benefits in embracing
@ and the other conjunctions as your friends, to be used as convenient.

 

Now in your first examples below, rectangular intermediate results are
inevitable anyway, so @ is not necessary.

 

I found function composition unnatural. I'm getting used to it and enjoying
mixing implicit and explicit as I am inclined. Sometimes, though, I have
little choice, especially with boxed ragged arrays.

 

> Date: Fri, 04 Jan 2013 06:18:01 -0500

> From: "Linda Alvord" < <mailto:[email protected]>
[email protected]>

> To: < <mailto:[email protected]> [email protected]>

> Subject: Re: [Jprogramming] Atop continues to puzzle me

> Message-ID: <002f01cdea6d$2936bb40$7ba431c0$@net>

> Content-Type: text/plain; charset=ks_c_5601-1987

> 

> Here's my progress so far:

> 

>    2  <mailto:|.@(*%221)> |.@(*"1) <mailto:|.@(*>  a=:i.2 3

>  4 2 0

> 10 8 6

>    (|."1) 2(*"1)a

>  4 2 0

> 10 8 6

>    2  <mailto:|.@:(*%221)> |.@:(*"1) <mailto:|.@:(*>  a

> 6 8 10

> 0 2  4

>    |. 2*"1 a

> 6 8 10

> 0 2  4

>    3 4 5<@#"0 i.3

> +-----+-------+---------+

> |0 0 0|1 1 1 1|2 2 2 2 2|

> +-----+-------+---------+

>    3 4 5#"0&.> i.3

> +-----+-------+---------+

> |0 0 0|1 1 1 1|2 2 2 2 2|

> +-----+-------+---------+

> 

> I am trying to remove &. following these rules:

> 

>    NB. x u&v y ? (v x) u (v y)

>    NB. u &.v is equivalent to the composition u & v

>    NB. except that the verb obverse to v is applied

>    NB. to the result for each cell

>    NB.(subject to the monadic rank of v)

> 

>    (<"1 3 4 5 )   #"0      (>"0  i.3)

> |length error

> |   (    <"1 3 4 5)#"0(>"0 i.3)

> 

>  The is one of my better tries to follow the directions.

> 

> Linda

 

Regards

 

Graham

 

----------------------------------------------------------------------

For information about J forums see  <http://www.jsoftware.com/forums.htm>
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

Reply via email to