] A.~ [: i. [: ! #

Linda

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of Nollaig
MacKenzie
Sent: Sunday, March 24, 2013 12:25 AM
To: [email protected]
Subject: Re: [Jprogramming] All rotations of a rank 1 vector


I like the anagram function:

   v
10 11 12
   rr
A.~ i.@:!@:#
   rr v
10 11 12
10 12 11
11 10 12
11 12 10
12 10 11
12 11 10

On 2013.03.24 15:20:35, you,
 the extraordinary Ric Sherlock, spake thus:

> Something like this might work :
> 1 2 3 |."0 1 ] 10 11 12
> Otherwise you should probably look at A.
> ({~ i.@!@# A. i.@#) 'abc'
> On Mar 24, 2013 2:55 PM, "Alex Giannakopoulos" 
> <[email protected]>
> wrote:
> 
> > I need to get all the rotations of a rank-1 vector i.e from 10 11 12  
> > to get  10 11 12, 11 12 10 and 12 10 11
> >
> > say my vector is size 3, I tried:
> >   i.3  |. 10 11 12
> > but it spits out a length error, as, of course, does  0 1 2 |. 10 11 
> > 12 Trying to change the rank of rotate doesn't seem to help, not how 
> > I'm doing it, anyhow.
> >
> > Any suggestions?

--
Nollaig MacKenzie
http://www.yorku.ca/nollaig
----------------------------------------------------------------------
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