inc 'z'
ba

 1 0 base 26.

for the problem, this isn't an issue as there is no wraparound to the first 
char of the input.





----- Original Message -----
From: Geoff Canyon <gcan...@gmail.com>
To: programm...@jsoftware.com
Sent: Friday, December 11, 2015 10:49 PM
Subject: Re: [Jprogramming] adventofcode 11

On Fri, Dec 11, 2015 at 6:56 PM, Ryan Eckbo <ec...@cim.mcgill.ca> wrote:

> inc=: >:&.(26&#.)&.(alpha&i.)
>

​I get:

   inc 'a'
b
   inc 'z'
ba
   inc 'y'
z

And my grasp of J isn't strong enough to figure out why. I came up with
this alternative that seems to work:

inc =: ((26&|)@>:)&.(alpha&i.)

Perhaps that could be simplified.



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

Reply via email to