This is the main way to do it, but as a "self contained" adverb that uses reshape
bycol =: 1 : '$~ (m |~ #) ,~ m <.@%~ #' NB. cuts off any incomplete rows 3 bycol i.8 0 1 2 3 4 5 On Saturday, May 16, 2020, 10:57:38 a.m. EDT, 'Rob Hodgkinson' via Programming <[email protected]> wrote: You could try Infix … here with NuVoc link… https://code.jsoftware.com/wiki/Vocabulary/bslash#dyadic x u\ y where x is eg _2 means apply very b to successive pairs (_ for non-overlapping). _2 ]\ 1 2 3 4 5 6 1 2 3 4 5 6 _2 ]\ 1 2 3 4 5 6 7 1 2 3 4 5 6 7 0 _2 <\ 1 2 3 4 5 6 ┌───┬───┬───┐ │1 2│3 4│5 6│ └───┴───┴───┘ HTH…/Rob > On 17 May 2020, at 12:42 am, Raoul Schorer <[email protected]> wrote: > > Hello, > > I am convinced that this must be trivial, but I wasn't able to find in the > documentation how to reshape a list to a table without manually extracting > the length. > > in summary, is there a more direct way of doing: > > lst =. i. 6 > > ((2,~2%~#) $ ]) lst > > for a list of arbitrary length? > > Thanks! > > Raoul > > ---------------------------------------------------------------------- > 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
