Thanks. I think you're right about the shuffling but I am keen to stay as faithful as I can to the algorithm as originally described without loosing too much efficiency. Odd numbers of agents are not allowed. I should make that clear in the text.
I've not had problems with Notebook to pdf, but maybe my notebooks are all small enough. I now have a workaround for my problem: export to markdown, then use pandoc with --pdf-engine=xelatex --variable monofont="APL385 Unicode"`
@Adam discussion earlier took me back to the traditional 'count leading backticks' solution, which I like as a good example of array vs procedural thinking.
I don't even have to do the ↑ in RickedyPs solution, as the data comes from a native file and I can just as easily get a matrix as a vector of vectors. And it's old skool - the way I'd have tackled it in the 80s.
I have a vector of character vectors, and I want a boolean to tell me which vectors start with three backticks. I can do it with each, but I can' t get rank to give me a simpler solution.
@Adám Thanks for offering to help with un-dinosauring the code in my APL book. I will take you up on that. I also mis-stated the target audience; I wrote it to help Raspberry Pi users to experiment with APL. Many will be school students but some will be hobbyists or teachers.