Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: The golf course looks great, my swing feels good, I like my chances (Part II)

by ambrus (Abbot)
on May 01, 2009 at 10:32 UTC ( #761252=note: print w/ replies, xml ) Need Help??


in reply to The golf course looks great, my swing feels good, I like my chances (Part II)

You know, it doesn't really surprise me that perl isn't always optimal for golf. I've seen it in action in that fibonacci golf tingy at Re: Fibo Golf challenge on 3 monkeys and (OT) Fibonacci numbers in Ruby - final shot - 24 chars etc. Also, when I write one-liners, which I do a lot, and I don't golf on purpose, the ruby ones always turn out to be shorter than the perl ones, only the ruby ones get hard to manage earlier when they grow. Ruby just has a larger, better standard library for basic things, but cpan wins when you need more complicated stuff like xml parsing.

As for ruby,

did you look at that golf prelude thingy in ruby-1.9.0? I never tried it, but I've seen it's there. It has some methods and stuff (like Integer.each instead of Integer.times) defined in such a way to ease golfing but that you wouldn't want to use in sane code, and it also defines the equivalent of AUTOLOAD so you can abbreviate methods to the shortest unique prefix or something. I've no idea how you're supposed to use it officially, but it's in file golf_prelude.c, which is called by goruby.c, which I guess you compile to a goruby executable using some hidden makefile switch or something. (Update: though in 1.9.0 you lose the Kernel#getc method that was already depreciated in 1.8.5.)


Comment on Re: The golf course looks great, my swing feels good, I like my chances (Part II)
Re^2: The golf course looks great, my swing feels good, I like my chances (Part II)
by eyepopslikeamosquito (Canon) on May 02, 2009 at 00:59 UTC

    Though I'll give a more detailed analysis in my next article, I just did a quick count of the last ten codegolf games. Ruby and Perl always finished first and second in code length: Perl won 6 times, Ruby 4 times. As for the longest solutions, it was: PHP 7 times, Python 3 times. That agrees with my impression when playing these games: Perl and Ruby are (often quite excitingly) vieing for the Silver Cup, while Python and PHP are battling for the wooden spoon. What surprised me enormously is popularity, measured by number of entries: Python 5, Ruby 4, Perl 1. It seems that golf is more popular in Python than Perl nowadays. That shocked me, because four years ago the top google hit for "Python golf" was a lovely pair of Python skin ladies golf shoes. :)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://761252]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2014-08-23 03:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (171 votes), past polls