On Tue, Oct 20, 2009 at 2:24 PM, I wrote:
>   rot13=:{&((65 97+/i.26)13&|."1@:[}i.256)&.(a.&i.)
> is the same length as the K implementation
> http://www.miranda.org/~jkominek/rot13/k/rot13.k
>   rot13:_ci[,/@[(0 65 91 97 123)_!256;1 3;13...@_ic

But @:[ is overkill when @[ does the same thing
    rot13=:{&((65 97+/i.26)13&|."1...@[}i.256)&.(a.&i.)

And we can can shave off another character by
rearranging the table of letter indices
   rot13=:{&((65 97+/~i.26)13&|....@[}i.256)&.(a.&i.)

47 characters is not too bad.  If we wanted we could
add back in a bit of whitespace and not be longer than
the K approach.

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to