There is a recent thread you might be interested in: http://jsoftware.com/pipermail/programming/2017-August/048275.html
I like this one from Arie Groeneveld vari =: 4 :'y,/@:(],"1 0 -."1)^:(x-1) ,.y' 2 vari 'abc' ab ac ba bc ca cb 2 vari i.4 0 1 0 2 0 3 1 0 1 2 1 3 2 0 2 1 2 3 3 0 3 1 3 2 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
