I was trying to solve the "What surrounds my Minesweeper tile?" question in J. I came with an initial (long) solution, but cannot make the '?' (deal) verb work as I want inside the finction:
f=._3]\](4&}.@],[,4{.])(8?8){8{.1$~]
8?8 works fine in the interpeter and gives a different permutation of the list 0-7, but in the function it just remembers the result of the first invokation, for example 5 0 7 3 6 1 4 2 and uses it for each subsequent call to the function.
How can this be fixed?