Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Linda Alvord
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread R.E. Boss
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]

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Robert Cyr
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{.

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Robert Cyr
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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{])) '['

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Robert Cyr
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:

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Viktor Cerovski
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Raul Miller
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.

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread David Ward Lambert
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Robert Cyr
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Brian Schott
#'[:|:((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=:[:|

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread bob therriault
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

Re: [Jprogramming] Print Custom Alphabet

2012-08-27 Thread Ric Sherlock
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: >#'[: