Not Beta as Bill points out, but better to stick to one thread?!
Anyway,  these offerings are more self contained,   in using Q's
size implicitly rather than assuming it's known.

I've avoided using @ and @: as Linda eschews them,  but am
probably breaking one or two of her rules for straightforward J.

(Apologies if Thunderbird screws up the display)

NB. rotate horizontally by 1 2 3 ...
   (|."0 1~(1+[:i.#))Q
BCDA

GHEF

LIJK

MNOP


NB. take horizontally 1 2 3 ...
   ({."0 1~(1+[:i.#))Q

A

EF

IJK

MNOP


Linda might also find these interesting:

NB. take 1 2 3 ... and then rotate rows horizontally
   (([:|.{.)"0 1~(1+[:i.#))Q

A

FE

KJI

PONM


NB. rotate rows by 1 2 3 ... and then take 1 2 3 ... horizontally
   (([|.{.)"0 1~(1+[:i.#))Q

A

FE

KJI

PONM


Time & space for one of these on a reasonably large argument:


    ts'(([{.|.)"0 1~(1+[:i.#))1000 1000$,Q'

0.00233033 2.9472e6


Mike


On 13/01/2015 14:42, Linda Alvord wrote:
Is there an easier way to get from Q to T  in larger situations?

    ]Q=:4 4$'ABCDEFGHIJKLMNOP'

ABCD
EFGH
IJKL
MNOP

    ]R=: (1|.'ABCD'),(2|.'EFGH'),(3|.'IJKL'),:0|.'MNOP'

BCDA
GHEF
LIJK
MNOP

      ]S=:1 2 3 0 |."1 Q

|length error
|   ]S=:1 2 3 0    |."1 Q

    ]T=:(|.i.4)|.!.' '"0 1 R

A
EF
IJK
MNOP

Linda




---
This email has been checked for viruses by Avast antivirus software.
http://www.avast.com



-----
No virus found in this message.
Checked by AVG - www.avg.com
Version: 2014.0.4800 / Virus Database: 4257/8927 - Release Date: 01/13/15
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to