Hello Linda

There is sa little bug in my proposed system and so in your last example too
the last shift should be negative in this way the table is reshaped in the
right position

I think the correct function should be like this

 f=: 13 :'<"0 (-x)|."1((1{$y)$0),.x|."1"1 y'

2 f i.8 8




On Tue, Jul 21, 2015 at 11:22 AM, R.E. Boss <[email protected]> wrote:

> Nicer even is
>
>    ((-~i.)3) 1 3 0 (1 :(':';'t/:"1 m~."1@,. i.@#"1 t=.x,.y')) i.3 4
>  0 _3 1  2  3
>  4  5 6 _2  7
> _1  8 9 10 11
>
>
> R.E. Boss
>
>
> > One could also scatter the column over the table
> >
> >    ((-~i.)3) 1 3 0 (1 :(':';'t/:"1 m([,-.~)"0 1 i.@#"1 t=.x,.y')) i.3 4
> >  0 _3 1  2  3
> >  4  5 6 _2  7
> > _1  8 9 10 11
> >
> >
> > R.E Boss
> >
> > > I would prefer
> > >
> > >    '-' 3 (1 :(':';'(x,y)/: m([, -.~) i.# x,y')) 'hello'
> > > hel-lo
> > >
> > >
> > > R.E. Boss
> > >
> > >
> > > > From a discussion a while ago I kept the following:
> > > >
> > > > NB. insert new items into an array - behaves like amend.
> > > > ins =: 1 : (':'; 'x ((+i.@#)m)}(>:(i.#y)e.m)#y')
> > > >
> > > > For example:
> > > >
> > > >    '-' 3 ins 'hello'
> > > > hel-lo
> > > >
> > > > It also does:
> > > >    column 2 ins"1 table
> > > > --T-T-T-┐
> > > > │0│1│0│2│
> > > > +-+-+-+-+
> > > > │3│4│0│5│
> > > > +-+-+-+-+
> > > > │6│7│0│8│
> > > > L-+-+-+--
> > > >
> > > > Ben
> > > >
> > > >
> > > > ________________________________________
> > > > From: [email protected] [programming-
> > > > [email protected]] on behalf of Strale [[email protected]]
> > > > Sent: Monday, July 20, 2015 14:11
> > > > To: [email protected]
> > > > Subject: [Jprogramming] insert column into tables
> > > >
> > > > Hello
> > > >
> > > > I am trying to combine Tables togethers
> > > >
> > > > for example I would like to insert column before the column 2 of the
> > table
> > > >
> > > >    [table =. 3 3 $  <"0 i.9
> > > >
> > > > --T-T-┐
> > > >
> > > > │0│1│2│
> > > >
> > > > +-+-+-+
> > > >
> > > > │3│4│5│
> > > >
> > > > +-+-+-+
> > > >
> > > > │6│7│8│
> > > >
> > > > L-+-+--
> > > >
> > > >
> > > >    [column =. 3 1$ (<,'0')
> > > >
> > > > --┐
> > > >
> > > > │0│
> > > >
> > > > +-+
> > > >
> > > > │0│
> > > >
> > > > +-+
> > > >
> > > > │0│
> > > >
> > > > L--
> > > >
> > > >
> > > >
> > > > the solution I have found at the moment is the following:
> > > >
> > > >
> > > >    [tab2 =. 2|."1  table
> > > >
> > > > --T-T-┐
> > > >
> > > > │2│0│1│
> > > >
> > > > +-+-+-+
> > > >
> > > > │5│3│4│
> > > >
> > > > +-+-+-+
> > > >
> > > > │8│6│7│
> > > >
> > > > L-+-+--
> > > >
> > > >
> > > >    [tab3 =. column ,"1 1    tab2
> > > >
> > > > --T-T-T-┐
> > > >
> > > > │0│2│0│1│
> > > >
> > > > +-+-+-+-+
> > > >
> > > > │0│5│3│4│
> > > >
> > > > +-+-+-+-+
> > > >
> > > > │0│8│6│7│
> > > >
> > > > L-+-+-+--
> > > >
> > > >
> > > > Result:
> > > >
> > > >    2|."1 tab3
> > > >
> > > > --T-T-T-┐
> > > >
> > > > │0│1│0│2│
> > > >
> > > > +-+-+-+-+
> > > >
> > > > │3│4│0│5│
> > > >
> > > > +-+-+-+-+
> > > >
> > > > │6│7│0│8│
> > > >
> > > > L-+-+-+--
> > > >
> > > >
> > > > Can you suggest me a better solution ?
> > > >
> > > > Thanks
> > > >
> > > > Paolo
> > > >
> ----------------------------------------------------------------------
> > > > 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
> > ----------------------------------------------------------------------
> > For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
We are made of star dust
(Carl Sagan)
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to