This doesn't account for '.' or '%' but how would you write it in a one line
version to count its tokens?
g=: 13 :'(1{+/"1 y=A){}:"1(>:+/,(i.2 26)*y=A)|."1
A=:|:((i.26)+/a.i.''aA''){a.'
g 'W'
XYZABCDEFGHIJKLMNOPQRSTUV
I wondered if it was condensed it could be a useful strategy.
Linda
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of bob
therriault
Sent: Monday, August 27, 2012 4:16 AM
To: [email protected]
Subject: Re: [Jprogramming] Print Custom Alphabet
Actually the conversion using &. wasn't required.
(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@])) '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
A
(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@])) 'j'
klmnopqrstuvwxyzabcdefghi
(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@])) '['
#'(,.@]^:(''.''e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@]))'
58
Cheers, bob
On 2012-08-25, at 3:25 AM, Viktor Cerovski wrote:
>
>
> bob therriault-2 wrote:
>>
>> Actual 66 character version after eliminating unnecessary conversions
>> from a. and back
>>
>> (,.@]^:('.'e.[)(a{~(>:i.25)+(a=.a.{~,65 97+/26|i.51)i.{.)) ::(0$]) 'e.'
>>
>> Surprisingly, removing assignments makes it one character longer
>>
>> (,.@]^:('.'e.[)(a.{~,65 97+/26|i.51)&([{~(>:i.25)+[i.{.@])) ::(0$]) 'e'
>>
> They can be of equal length if [i.{.@] is replaced by (i.{.) as in
>
> (,.@]^:('.'e.[)(a.{~,65 97+/26|i.51)&([{~(>:i.25)+(i.{.))) ::(0$]) 'e'
>
> which can be furthermore shortened by 2 characters by replacing
>
> ([{~(>:i.25)+[i.{.@])
>
> with
>
> (25{.[|.~1+(i.{.))
>
> giving
>
> (,.@]^:('.'e.[)(a.{~,65 97+/26|i.51)&(25{.[|.~1+(i.{.))) ::(0$]) 'e'
>
>
>> cheers, bob
>>
>> On 2012-08-24, at 5:16 PM, bob therriault wrote:
>>
>>> 67 characters with same issue that Raul mentions that argument would
>>> need to be quoted.
>>>
>>> (,.@]^:('.'e.[)(a.{~a{~(>:i.25)+(a=.,65 97+/26|i.51)i.a.i.{.)) ::(0$])
>>> 'f'
>>>
>>> spaced below for legibility
>>>
>>> (,.@]^:('.'e.[) (a.{~a{~(>:i.25)+(a=.,65
>>> 97+/26|i.51)i.a.i.{.)) :: (0$])
>>> decision output generate list
>>> input error
>>>
>>> cheers, bob
>>>
>>> On 2012-08-24, at 12:16 PM, Raul Miller wrote:
>>>
>>>> I'm not sure how to express that here.
>>>>
>>>> Consider, for example:
>>>> ,.^:('.'e.t)s{ ::($:&}.)~n+1+{.t i.~s=:a.{~,65 97+/26|i.51[n=:i.25[t=.
>>>>
>>>> Here, I need would need quotes around the argument. And, it's
>>>> still
>>>> 70 characters.
>>>>
>>>> --
>>>> Raul
>>>>
>>>> On Fri, Aug 24, 2012 at 3:01 PM, Roger Hui
>>>> <[email protected]>
>>>> wrote:
>>>>> I think it is customary to assume that the input is just an argument.
>>>>> The
>>>>> q solution so assumes.
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Aug 24, 2012 at 11:38 AM, Raul Miller
>>>>> <[email protected]>
>>>>> wrote:
>>>>>
>>>>>> On Fri, Aug 24, 2012 at 2:00 PM, Roger Hui
>>>>>> <[email protected]>
>>>>>> wrote:
>>>>>>> http://codegolf.stackexchange.com/questions/7036/print-custom-al
>>>>>>> phabet
>>>>>>>
>>>>>>> The gauntlet is thrown!
>>>>>>
>>>>>> The best I can see, right now, is:
>>>>>> ,.^:('.'e.t)s{ ::($:&}.)~n+1+s i.{.t=.1!:1##s=:a.{~,65
>>>>>> 97+/26|i.51[n=:i.25
>>>>>>
>>>>>> And this is 74 characters long -- 42% longer than another entry.
>>>>>>
>>>>>> Note that I am using something like 9 characters for the action
>>>>>> of reading input, and another 10 to give an empty result in an
>>>>>> adverse case.
>>>>>>
>>>>>> --
>>>>>> Raul
>>>>>> -----------------------------------------------------------------
>>>>>> ----- For information about J forums see
>>>>>> http://www.jsoftware.com/forums.htm
>>>>>>
>>>>> ------------------------------------------------------------------
>>>>> ---- For information about J forums see
>>>>> http://www.jsoftware.com/forums.htm
>>>> -------------------------------------------------------------------
>>>> --- For information about J forums see
>>>> http://www.jsoftware.com/forums.htm
>>>
>>> --------------------------------------------------------------------
>>> -- For information about J forums see
>>> http://www.jsoftware.com/forums.htm
>>
>> ---------------------------------------------------------------------
>> - For information about J forums see
>> http://www.jsoftware.com/forums.htm
>>
>>
>
> --
> View this message in context:
> http://old.nabble.com/Print-Custom-Alphabet-tp34345428s24193p34347462.
> html Sent from the J Programming mailing list archive at Nabble.com.
>
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm