News for hackers. Stuff that matters.
Re:Is Scala really more complicated than Java? by cousin_it on Friday September 18, 2009 @04:27PM (#831126)
I know that's totally beside the point, but I'd have coded the example like this:

    print """
        Happy Birthday To You
        Happy Birthday To You
        Happy Birthday Dear XXX
        Happy Birthday To You
    """
Re:Is Scala really more complicated than Java? by swannodette on Saturday September 19, 2009 @01:38AM (#831695)
Your solution is:

print"""Happy Birthday To You\nHappy Birthday To You\nHappy Birthday Dear XXX\nHappy Birthday To You""" -> 103 chars

This came up on the Clojure mailing list:

(dotimes[x 4](println"Happy Birthday"({2"Dear XXX"}x"To You"))) -> 63 chars

40 less characters.

Re:Is Scala really more complicated than Java? by cema on Saturday September 19, 2009 @02:23AM (#831725)
A nice trick! And can be derived directly from the "definition" of the song (that is, from the way the song is constructed). Great!