tacit version of "join at rank"

jr =: 1 : ', ,:^:((>: m) - #@$)'

(i. 3) 2 jr (i.2 3) (2 jr) 1

but easier general solution to insure rank 3 is to append first to i.0 0 0


(i. 2 3) ([ ,^:2 ,) i. 0 0 0

(i.2 3) , 1 1 , i. 0 0 0
0 1 2
3 4 5

1 1 0
0 0 0
________________________________
From: Raul Miller <[email protected]>
To: Programming forum <[email protected]> 
Sent: Monday, January 9, 2017 10:09 AM
Subject: Re: [Jprogramming] Appending Matrices


The general pattern is:
   a,a,a,a,a,:a

The verb which joins the last two is special, or your verb examines
the structure of the argument and makes a choice based on that.

That said, another approach is:
   2#,:a
   3#,:a
   ...
   6#,:a

That said, if you really want a verb which exactly corresponds to your
initial draft of your spec:

V=:4 :0
  if.2=#$y do. x,:y else. x,y end.
)

I hope this helps,

-- 
Raul



On Mon, Jan 9, 2017 at 10:00 AM, Skip Cave <[email protected]> wrote:
> Given array a:
>   a
>
> abcd
>
> efgh
>
> ijkl
>
>
> How does one laminate a with itself?
>
>
>   a,a   NB. I'm using , as a placeholder for the verb I want.
>
> abcd
>
> efgh
>
> ijkl
>
>
> abcd
>
> efgh
>
> ijkl
>
>
> What about more than once?
>
>
>   a,a,a
>
> abcd
>
> efgh
>
> ijkl
>
>
> abcd
>
> efgh
>
> ijkl
>
>
> abcd
>
> efgh
>
> ijkl
>
>
>
> Skip
> ----------------------------------------------------------------------
> 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

Reply via email to