'lc uc' =. +&(i.26)&.(a.&i.)"0 'aA'
t=: ((lc,uc)&i.) :. ({&(lc,uc))
(({.@],[,}.@])`,@.((26>[)+.25<{.@]))/&.|.&.t 'abcDEfghI'
abDEcfgIh
(({.@],[,}.@])`,@.((26>[)+.25<{.@]))/&.|.&.t 'AbC'
ACb
(({.@],[,}.@])`,@.((26>[)+.25<{.@]))/&.|.&.t 'XYZ'
XYZ
R.E. Boss
> -----Oorspronkelijk bericht-----
> Van: [email protected] [mailto:programming-
> [email protected]] Namens Henry Rich
> Verzonden: dinsdag 9 augustus 2011 22:46
> Aan: Programming forum
> Onderwerp: Re: [Jprogramming] Materials for NYCJUG meeting today -
> Tuesday 8/9 at Empire State Building
>
> I said not to try to shift the first element! That requires a design
decision. If
> you want to ignore leading shift requests, it's easy enough:
>
> shift =. 1 : '{~ (;@(<@(1&|.);.1) i.@#)@:(= *./\)@:u'
>
> 'lc uc' =. +&(i.26)&.(a.&i.)"0 'aA'
> p =. e.&uc
>
> p shift 'abcDEfghI'
> abDEcfgIh
> p shift 'AbC'
> ACb
> p shift 'XYZ'
> XYZ
>
> Henry Rich
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm