41 chars thanks to R.E.Boss and his 98-33^96 short-cut.

}.|:1j1#a.{~(-|.(i.25)+])(98-33^96>])3&u:'j'

The question on Stack Overflow doesn't mention vector input as being a
requirement.



On 30 August 2012 18:24, Eldon Eller <eel...@pacbell.net> wrote:

> This fails on some, but not all, illegal inputs:
>
>    |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 '5' NB. ok
>                                                      |:1j1#(25{.(u:,2#65
> 97+/i.26)(>:@i.}.[)])"0 '100' NB. gratuitous line feeds
>
>
>    |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 'lkjhfa' NB. does the whole
> vector
> m l k i g b
> n m l j h c
> o n m k i d
> p o n l j e
> q p o m k f
> r q p n l g
> s r q o m h
> t s r p n i
> u t s q o j
> v u t r p k
> w v u s q l
> x w v t r m
> y x w u s n
> z y x v t o
> a z y w u p
> b a z x v q
> c b a y w r
> d c b z x s
> e d c a y t
> f e d b z u
> g f e c a v
> h g f d b w
> i h g e c x
> j i h f d y
> k j i g e z
>
> |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 'a3' NB. acts as if 3 is a
> period.
>
> b
> c
> d
> e
> f
> g
> h
> i
> j
> k
> l
> m
> n
> o
> p
> q
> r
> s
> t
> u
> v
> w
> x
> y
> z
>
>
> On 08/30/2012 07:45 AM, bob therriault wrote:
>
>> Actually I think the shortest is still 43
>>
>>     |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 's'
>> t u v w x y z a b c d e f g h i j k l m n o p q r
>>     |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 's.'
>> t
>> u
>> v
>> w
>> x
>> y
>> z
>> a
>> b
>> c
>> d
>> e
>> f
>> g
>> h
>> i
>> j
>> k
>> l
>> m
>> n
>> o
>> p
>> q
>> r
>>     |:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0 '['
>>
>>     #'|:1j1#(25{.(u:,2#65 97+/i.26)(>:@i.}.[)])"0'
>> 43
>>
>> Cheers, bob
>>
>> On 2012-08-30, at 7:41 AM, R.E. Boss wrote:
>>
>>  Lose 1 char by replacing   98-33^96>3&u:   by   64+33^'`'I.]
>>>
>>>     |:1j1#}.@((i.~|.e.#])26{.a.}.~**64+33^'`'I.])"0'S'
>>> T U V W X Y Z A B C D E F G H I J K L M N O P Q R
>>>
>>> Is this, together with Millers solution, the shortest with 45 characters?
>>>
>>>    #'1j1#"1&|:(25{.]}.~1+i.~)&(u:**,2#65 97+/i.26)"0'
>>> 45
>>>
>>> The latter can be shortened 1 char by
>>>    1j1#"1&|:(u:,2#65 97+/i.26)&(25{.]}.~1+i.)"0
>>>
>>>
>>> R.E. Boss
>>>
>>>
>>>  -----Oorspronkelijk bericht-----
>>>> Van: 
>>>> programming-bounces@forums.**jsoftware.com<programming-boun...@forums.jsoftware.com>[mailto:
>>>> programming-bounces@**forums.jsoftware.com<programming-boun...@forums.jsoftware.com>]
>>>> Namens Robert Cyr
>>>> Verzonden: donderdag 30 augustus 2012 8:10
>>>> Aan: programm...@jsoftware.com
>>>> Onderwerp: Re: [Jprogramming] Print Custom Alphabet
>>>>
>>>>
>>>> So another correction is needed, and the line is now 3 characters too
>>>> long.
>>>>
>>>> |:1j1#}.@((i.~|.e.#])26{.a.}.~**98-33^96>3&u:)"0 's.'
>>>>
>>>> I need the 26 character of the alphabet.  I therefore remove my excess
>>>> character after rotation only.
>>>>
>>>> Many thanks.
>>>>
>>>> Robert Cyr
>>>>
>>>>
>>> ------------------------------**------------------------------**
>>> ----------
>>> For information about J forums see 
>>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
>>>
>> ------------------------------**------------------------------**
>> ----------
>> For information about J forums see 
>> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
>>
>>
> ------------------------------**------------------------------**----------
> For information about J forums see 
> http://www.jsoftware.com/**forums.htm<http://www.jsoftware.com/forums.htm>
>
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to