On Fri, Dec 11, 2015 at 10:49 PM, Geoff Canyon <gcan...@gmail.com> wrote:
> 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.

Assuming u and v are verbs, and y is a noun and the rank of y does not
exceed the rank of u or v (and assuming inv has retained its default
definition):

   u&.v y
is equivalent to
   v inv u v y

So, we can use that to reproduce the results you were getting, but
with a variant phrase (a bit clumsier, but easier to decompose):
   alpha=: a.{~ 97+i.26
   alpha&i.inv 26&#.inv >: 26&#. alpha&i. 'z'
ba

And, if we trim that back, we can start seeing intermediate results,
for example:
   26&#.inv >: 26&#. alpha&i. 'z'
1 0

Is this enough to make clear what was happening there?

Thanks,

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

Reply via email to