Thanks Raul!

> On Sep 12, 2018, at 9:24 AM, Raul Miller <[email protected]> wrote:
> 
> Well... here's one possibility:
> 
> https://rosettacode.org/wiki/Rot-13#J
> 
> Thanks,
> 
> -- 
> Raul
> 
> On Wed, Sep 12, 2018 at 11:19 AM Daniel Lyons <[email protected]> wrote:
>> 
>> Hi,
>> 
>> Not a super practical thing but I am sort of working on rot-13 for a blog 
>> post.
>> 
>> The basic idea is to treat alphabetic characters as numbers 0-25 and perform 
>> operations on them. This strikes me as a great example of &. under, and 
>> handling only alphabetic characters leads to a nice use of @. agenda. So I 
>> think in general the answer probably looks something like this:
>> 
>> alphatransform =: 1 : ']`(u&.<alpha-number>)@.<is-alphabetic> &.(a.&i.)
>> 
>> For instance, this is what I have now:
>> 
>>   ar =: 1 : '(]`(u&.(-&64))@.(<&90 *. >&64))"0 &.(a.&i.)'
>> 
>> This seems to do the trick for upper case:
>> 
>>   (26|13+]) ar 'ATTACK AT DAWN!'
>> NGGNPX NG QNJA!
>>   (26|13+]) ar^:2 'ATTACK AT DAWN!'
>> ATTACK AT DAWN!
>> 
>> I could add a third item to the gerund for lowercase and complicate the test 
>> a bit. But I thought I'd ask if I'm missing something obvious first.
>> 
>> Thanks,
>> 
>> --
>> Daniel Lyons
>> 
>> 
>> 
>> 
>> ----------------------------------------------------------------------
>> For information about J forums see http://www.jsoftware.com/forums.htm
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

-- 
Daniel Lyons




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

Reply via email to