TTA Perl Golf 1

Comments and discussion for articles on the site. To start a new thread, click "Post comment" from an article.

Moderators: Philippe, Tyler, Tony, Johnson

TTA Perl Golf 1

Postby Posting Bot on Thu Oct 19, 2006 5:29 pm

Tyler wrote:

Perl golf challenge, open to the public.

Full article: http://www.teamtotallyawesome.com/op_ed/298
User avatar
Posting Bot
Autonomous Process
 
Posts: 56
Joined: Mon Dec 27, 2004 3:57 pm
Location: Somerville, MA

Postby Tyler on Thu Oct 19, 2006 5:30 pm

map{print reverse $',/(,*)(".*?")/g}reverse<>

45 chars...I reserve the right to change my answer...
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Johnson on Fri Oct 20, 2006 2:15 pm

while(<>){s/\n//;print join(',',reverse split','),(/,$/)?",\n":"\n";}

70 chars including 3 necessary spaces.
Steve wrote:Nintendo's like a deadbeat dad. It's really fun when he shows up on holidays, but the rest of the year it's just empty promises and false hope.
User avatar
Johnson
Founding Member, Faceless Warrior
 
Posts: 1408
Joined: Thu Oct 30, 2003 12:32 pm
Location: Andover, MA

Postby Shotfrog on Fri Oct 20, 2006 2:16 pm

What the fuck are you talking about
I believe it was a boaking accident. I have to go.
User avatar
Shotfrog
Registered User
 
Posts: 642
Joined: Fri Feb 20, 2004 10:20 am
Location: Federline

Postby Shotfrog on Fri Oct 20, 2006 2:19 pm

Oh wait, I got it:

You guys are gigantic faggots
I believe it was a boaking accident. I have to go.
User avatar
Shotfrog
Registered User
 
Posts: 642
Joined: Fri Feb 20, 2004 10:20 am
Location: Federline

Postby Johnson on Fri Oct 20, 2006 2:19 pm

Hey, now. Are the lines supposed to be reversed as well? That is, lines 1-3 are printed as 3-2-1? Nothing in the original rules about that, though I now see it's like that in the example...
Steve wrote:Nintendo's like a deadbeat dad. It's really fun when he shows up on holidays, but the rest of the year it's just empty promises and false hope.
User avatar
Johnson
Founding Member, Faceless Warrior
 
Posts: 1408
Joined: Thu Oct 30, 2003 12:32 pm
Location: Andover, MA

Postby Tyler on Fri Oct 20, 2006 3:12 pm

Yep, just like in the example.
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Tyler on Fri Oct 20, 2006 3:13 pm

Shotfrog wrote:Oh wait, I got it:

You guys are really awesome


FYS
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Johnson on Fri Oct 20, 2006 3:14 pm

Tyler wrote:Yep, just like in the example.

"Read a CSV file from STDIN, and reverse the fields per-line" -- nothing is ever said about reversing the order of the lines themselves.
Steve wrote:Nintendo's like a deadbeat dad. It's really fun when he shows up on holidays, but the rest of the year it's just empty promises and false hope.
User avatar
Johnson
Founding Member, Faceless Warrior
 
Posts: 1408
Joined: Thu Oct 30, 2003 12:32 pm
Location: Andover, MA

Postby Tyler on Fri Oct 20, 2006 3:36 pm

That's why I have the example, to clarify any ambiguity in the description.
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Johnson on Fri Oct 20, 2006 3:54 pm

I'm not sure I would call that ambiguity.

Stalemate it is! Everyone wins!
Steve wrote:Nintendo's like a deadbeat dad. It's really fun when he shows up on holidays, but the rest of the year it's just empty promises and false hope.
User avatar
Johnson
Founding Member, Faceless Warrior
 
Posts: 1408
Joined: Thu Oct 30, 2003 12:32 pm
Location: Andover, MA

Postby Tyler on Fri Oct 20, 2006 4:15 pm

IT'S PERL GOLF NOT RULES LAWYER GOLF
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Tyler on Fri Oct 20, 2006 6:37 pm

Well, unless someone comes up with something more clever, I think the difference between yours and mine is the difference of 1 use of the word "reverse"...although I structured it the way I did specifically to avoid the use of the -n command line flag

EITHER WAY I WIN
Last edited by Tyler on Fri Oct 20, 2006 6:40 pm, edited 1 time in total.
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Postby Johnson on Fri Oct 20, 2006 6:40 pm

Tyler wrote:Well, unless someone comes up with something more clever, I think the difference between yours and mine is the difference of 1 use of the word "reverse"

And like a million characters.
Steve wrote:Nintendo's like a deadbeat dad. It's really fun when he shows up on holidays, but the rest of the year it's just empty promises and false hope.
User avatar
Johnson
Founding Member, Faceless Warrior
 
Posts: 1408
Joined: Thu Oct 30, 2003 12:32 pm
Location: Andover, MA

Postby Tyler on Fri Oct 20, 2006 6:44 pm

-n print reverse$',/(,*)(".*?")/g

Johnson's way, 33 chars.
Oh, I just wanted to see if I could run my own web server. It ain't some big deal like the main nerds would have you believe. This crud is fly-easy if you can make yourself care. - Ray Smuckles
User avatar
Tyler
Founding Member, Chief Morale Officer
 
Posts: 987
Joined: Thu Oct 30, 2003 1:33 pm
Location: in ur base cappin ur flag

Next

Return to Article Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron