I got it down to 104 characters on my first pass:
(10{a.),@:,.~(' _|'{~3 i 27 i
2832(i=.#.^:_1)32223677614513270047615810867287021x),./@:{~'0123456789'i.]
Of those, (the first) 13 are used to make the solution strictly compatible with
the spec. To wit: they turn J's natural matrix
representation into Python's natural string representation.
Of the remaining 94, 69 are dedicated to the representation and expansion of
the lookup table. I took the braindead approach of
storing the table in an extended integer. A smarter representation will
provide the most bang for the buck in the next
generation.
One idea I had was to exploit the J environment's new tolerance for Unicode.
Unicode can encode a lot of data in a small space,
especially if we're counting characters, not bytes.
Hmm, now that I think about it, maybe I should have stored the data in a
special ASCII string. The quote marks themselves would
only cost me 1 character ('cause I had to use a trailing x for the extended
integer)....
Of course, we could just look at the (winning) Python entries, and steal their
encoding ideas ... :)
-Dan
PS: My solution depends only on the interpreter (v6), not on any names
provided by scripts. It could be made 5 characters
shorter immediately if I could depend on the definition of LF .
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm