This also works with length 64
(,.@]^:(46 e.[)(,,.~65 97+/i.26)&([:}.26{.[}.~[i.{.@]))&.(a.&i.) 'B'
CDEFGHIJKLMNOPQRSTUVWXYZA
(,.@]^:(46 e.[)(,,.~65 97+/i.26)&([:}.26{.[}.~[i.{.@]))&.(a.&i.) '['
(,.@]^:(46 e.[)(,,.~65 97+/i.26)&([:}.26{.[}.~[i.{.@]))&.(a.&i.) 'B.'
C
D
E
F
G
H
I
J
K
L
M
N
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
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
Nice solution.
$(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@])) '['
25
$(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.[}.~[i.{.@])) '[.'
25 1
R.E. Boss
> -Oorspronkelijk bericht-
> Van: [email protected]
> [mailto:[email protected]
Or simply:
w=: 3 : ',.^:(''.''e.y)(o-~a.i.0{y)|.26{.a.}.~o=.98-33^96>a.i.0{y'
w 's.'
stuvwxyzabcdefghijklmnopqr
w 'T.'
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
S
On Mon, Aug 27, 2012 at 6:27 AM, R.E. Boss wrote:
> Nice solution.
>
>$(,.@]^:('.'e.[)(a.{~,,.~65 97+/i.26)&(1}.26{.
You can also save a few keystrokes, even ending up with 53 if you do not
name the thing.
w=:3 : ',.^:(''.''e.y)(d-o)|.26{.a.}.~o=.98-33^96>d=.a.i.0{y'
Sent from my iPad
On 2012-08-27, at 14:40, Robert Cyr wrote:
Or simply:
w=: 3 : ',.^:(''.''e.y)(o-~a.i.0{y)|.26{.a.}.~o=.98-33^96>a.i.0{y'
w
Hey Robert,
Nice to see a fresh approach.
First impressions:
I think that the specs require that the result start with the letter after the
input (yours starts with the input letter).
I get this result
3 :',.^:(''.''e.y)(o-~a.i.0{y)|.26{.a.}.~o=.98-33^96>a.i.0{y' '['
ABCDEFGHIJKLMNOPQRSTUVW
Tweaks get me down to 55
(,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(26{.[}.~1+[i.0{])) 'u'
vwxyzabcdefghijklmnopqrstu
(,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(26{.[}.~1+[i.0{])) 'u.'
v
w
x
y
z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
(,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(26{.[}.~1+[i.0{])) '['
Oops,
should have been
(,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(25{.[}.~1+[i.0{])) 'u.'
v
w
x
y
z
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
got greedy with the {.
cheers, bob
On 2012-08-27, at 12:17 PM, bob therriault wrote:
> Tweaks get me down to 55
>
> (,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(26
Thanks for the comments.
Finally, validation gets expensive:
www=. 3 :',.^:(''.''e.y),(p<27)#t|." 0 1 ~p=:1+(t=.(97 65+/i.26){a.)i."1 (0{y)'
A bit of saving is possible, but I have to admit that a tacit solution
is a better bet.
Sent from my iPad
On 2012-08-27, at 15:30, bob therriault wrote:
Bob proposed:
(,.@]^:('.'e.[)(a.{~,2#65 97+/i.26)&(25{.[}.~1+[i.0{]))
Three characters shorter version:
(,.@]^:('.'e.[)25{.(a.{~,2#65 97+/i.26)(>:@i.}.[){.)
--
View this message in context:
http://old.nabble.com/Re%3A-Print-Custom-Alphabet-tp34348204s24193p34348204.html
Sent from the J P
Borrowing some ideas from other people in this thread:
f=:[:|:((i.|.-.)~(a.{~65 97+/i.26)&(*@#.@e.,@#[))"0
Example uses:
f 'a'
f '-'
f 'C.'
--
Raul
--
For information about J forums see http://www.jsoftware.com/forums.
The perl solution best fits the problem description.
perl -ne 's!^([a-z])(\.?)$!print chop().($2?$/:$")for($1..a.$1)[1..25]!
ie'
http://codegolf.stackexchange.com/questions/7036/print-custom-alphabet
At the right hand side of Bob's sentence identify [i.{.@] as hook (i.{.)
to save a character. R
Wow,
If you take out the assignment and wrap it in brackets, I see a solution in 50
characters. Impressive Raul, you should put that up on the contest site.
Previous leader was Golfscript at 53
I'm gonna take a look at how you did it later tonight. The best thing about
these contests with the
Really nice.
Perhaps the list should end with with the requested letter. It seems
a few more characters will be needed.
Cheers
Robert Cyr
Sent from my iPad
On 2012-08-27, at 21:30, bob therriault wrote:
> Wow,
>
> If you take out the assignment and wrap it in brackets, I see a solution in
#'[:|:((i.|.-.)~(a.{~65 97+/i.26)&(*@#.@e.,@#[))"0'
48
#'|:@((i.|.-.)~(a.{~65 97+/i.26)&(*@#.@e.,@#[))"0'
47
I don't remember ever seeing monadic e. used. Sweet.
---
(B=)
On Aug 27, 2012, at 7:04 PM, Raul Miller wrote:
> Borrowing some ideas from other people in this thread:
>
> f=:[:|
Hi Brian,
I haven't had a chance to really take this apart to see how it ticks, but are
you sure that e. is monadic? It looks like the first verb on the left tine,
which I usually would think is dyadic, but there may be more things than are
dreamt of in my philosophy.
Also, I don't think your
There is no monadic e. used here. It is basically
(a.{~65 97+/i.26) e.
The only part of the problem specification that I don't think many of
the J versions are addressing is that the list of letters should be
separated by spaces.
On Tue, Aug 28, 2012 at 2:48 PM, Brian Schott wrote:
>#'[:
18 matches
Mail list logo