Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Rosetta Code : similar programs written in various languages (rosettacode.org)
42 points by gourneau on July 22, 2010 | hide | past | favorite | 11 comments


Such a great site. The page on flattening arrays blows me away at how different and beautiful some languages can be (especially Ruby and Erlang's take).

http://rosettacode.org/wiki/Flatten_a_list


I'll give you Erlang, but the Ruby solution is cheating rather.


Here's a better Ruby version:

    module Enumerable
      def custom_flatten
        inject([]) do |result, element|
          if element.respond_to?(:custom_flatten)
            result.concat(element.custom_flatten)
          else
            result.push(element)
          end
        end
      end
    end
Works on all Enumerables (Array, Hash, Set, etc)


How is Ruby's method and different than Groovy or JavaScript? I think their all pretty neat. Goes to show that there is always more than one way to skin a list.


True. I guess built-in functions shouldn't count.


There’s also http://99-bottles-of-beer.net/, which is basically the same thing but only for printing out the lyrics of the 99 Bottles of Beer song. It has a version in pretty much any language you can think of. However, some of the versions are made not to show the language’s normal way to print the lyrics but to show a strange way only possible in that language.


They did JavaScript concurrency wrong! omg! http://rosettacode.org/wiki/Concurrent_computing#JavaScript

We have workers now. But seriously, it is an amazing resource. I was looking this stuff up on wikipedia but that has almost no detail.


Michael Mol did a demo of rosetta for the Lansing, MI perl mongers and it was a riot (far better than my DBIC/architecture talk).

There are fewer better forms of entertainment for geeks than eating pizza while discussing common programming expressions implemented in bizarre and obscure languages.


Yeah, the site is fantastic. He's a funny dude.

I helped out with RosettaCode a few years back, hosted it for a little while on my SliceHost instance when they had some trouble. My <a href="http://rosettacode.org/wiki/User:Mwn3d>good friend</a> contributes all the time.

Glad to see the site still exists and is flourishing, albeit slowly.


And much appreciated. I don't know when I'd have had the stones to switch to VPS (I still don't think of myself as a sysadmin all that much) if you hadn't helped us jump over to Slicehost. I've got a 2GB RAM node over at prgmr.com, now; more RAM than I know what to do with.

Site grows slowly because it's growing steadily. Well, that, and I haven't had the time to set up income or the really nice features that would depend on it. :)

If you ever hit the GRR area, I need to buy you a drink.


It's worth having a look through Rosetta-stone tagged questions on Stack Overflow. There's a large overlap with code golf entries.

http://stackoverflow.com/questions/tagged/rosetta-stone




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: