You can just use rotate with rank: (|."0 1~ i.@#) 3 4#1 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0
Also, if you wanted a solution using power, you could do 1&|.^:(<@#) 3 4#1 0 1 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 The critical part here is that power with a boxed argument saves the intermediate results (a^(<n) is equivalent to a^(i.n)). On Thu, Oct 13, 2011 at 6:59 PM, David Vaughan <[email protected] > wrote: > Thanks. I hadn't used E. before. > > How could I generate a list of all rotations of booleans? > > I've been trying to somehow use ^: in this sort of fashion: > > (1|."1)^:6 (3+i.5)$"0]1 > 0 1 1 1 0 0 0 > 0 1 1 1 1 0 0 > 0 1 1 1 1 1 0 > 0 1 1 1 1 1 1 > 1 1 1 1 1 1 1 > > Obviously this is not producing the intermediate states - what I'm looking > for is, for example (taking just the first line 1 1 1 0 0 0 0) > 1 1 1 0 0 0 0 > 1 1 0 0 0 0 1 > 1 0 0 0 0 1 1 > 0 0 0 0 1 1 1 > 0 0 0 1 1 1 0 > 0 0 1 1 1 0 0 > 0 1 1 1 0 0 0 > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
