Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

Looking for a code samples that present a code fragment in plain English, Perl, Python, and Ruby. Here's an example of a whole mini-solution present in that format, but I'd rather just have the code present in a fragment-by-fragment basis.

share|improve this question

closed as not constructive by dmckee, Monolo, Jeremy Banks, A.H., CodeGnome Jul 15 '12 at 4:20

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.

10  
Rosetta Code –  aaronasterling Dec 4 '10 at 23:03
6  
People write crap in Perl and then complain it is not very readable. CICO. –  Sinan Ünür Dec 4 '10 at 23:36
2  
Well, the guy you give as an example wrote ugly code and complained about it being ugly and chose it as a reason to leave Perl. I say self-selection is working. –  Sinan Ünür Dec 5 '10 at 0:41
1  
Beauty is in the eye of the beholder, but here's my take on the code in your example: blog.nu42.com/2010/12/dont-blame-perl-for-all-ugly-code.html –  Sinan Ünür Dec 7 '10 at 5:35
2  
Those are fine books. I have them all. However, I learned what I learned by reading the documentation that comes with Perl and Perl modules, a lot of trial and error, asking questions and trying to answer others' questions. I am no expert in Ruby or Python, but I believe they are equally capable languages compared to Perl (although, Perl's Unicode support seems to be way ahead of theirs at the moment). I have grown really fond of sigils and CPAN has saved me countless hours and provided generous returns on my investment. –  Sinan Ünür Dec 7 '10 at 19:13

2 Answers 2

up vote 2 down vote accepted

Rosetta Code currently has 449 tasks, of which some 349 languages are covered, though the site does not (and cannot) promise to have solutions to every task in every language.

NOTE: aaronasterling posted Rosetta Code as a comment to the question, but never as an answer. After 24-hours, posted it as an answer myself, since I'm not planning on leaving my question open forever, and it's an answer to the question. Feel free to up vote the comment, and not this answer; if aaronasterling post it as an answer, I'll delete this answer.

share|improve this answer

A good place to look would be Project Euler where (after solving the puzzles yourself) you get access to solutions by other people in all kinds of programming languages. Of course, sometimes there will be atrocious solutions, so you'd have to look at the answers carefully.

share|improve this answer
1  
... albeit that's most math-related problems. –  delnan Dec 4 '10 at 23:07
    
@delnan: Knowing nothing about math, I in fact find it interesting that mathematical notation could be a replacement for English in the context of this question; in part based on my assumption that mathematical notation is universal across languages. –  blunders Dec 4 '10 at 23:10
    
@Tim Pietzcker: +1 Thanks, given it's not an extact match my request for a comparison of just the covered languages on a fragment-by-fragment basis (without having to code an answer) going to wait and see if anyone else answers. If not, I'll select you as the answer. Again, thanks! –  blunders Dec 4 '10 at 23:12
    
@blunders: But depending on what you want (just basic syntax comparision, or actually see idioms etc.), it could be a con that most programs on Project Euler fall into a few categories. For example, I don't think there is any problem over there that requires file I/O. For seeing many different tasks implemented in many different programming languages, see Rosetta Code. –  delnan Dec 4 '10 at 23:16
    
@delnan: Yes, I agree, but nothing's every going to be perfect, in this case readability related to cross referencing the sample at hand is the biggest thing to me. I'm 100% sure there differences in the implementations of the compilers, syntax, etc. that might make some problems impossible, or non-effective in one language or another. Just focused on the core syntax and idiomatic expression in a given language. –  blunders Dec 4 '10 at 23:22

Not the answer you're looking for? Browse other questions tagged or ask your own question.