No, G is not minimal. It is counted as 18 words. I should not
have said #@:;: , but did not want to re-open the debate on how to
count words in such a contest.
Currently, explicit code is counted as the number of words of
declaration plus the number of words of definition, plus 1. In the
case of G , there are 2 words of declaration (i.e. 3 : ) and 15
words of definition (i.e. (0&,. , 1&,.@|.)^:y i.1 0 ).
This definition is recursive and is open to future elaboration,
restriction, refinement, and arbitrary change which can apply
retroactively. (Much as in my paid work, as the cheaters cheat I
will install new rules to prohibit them.)
Your solution is lovely, and I wish I'd thought of it (monadic
~:/\^:_1 ). Please record it (and any future solutions) in the Wiki,
at http://www.jsoftware.com/jwiki/Puzzles/Gray_Code .
-Dan
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm