News for hackers. Stuff that matters.
Re:Teaching Perl to Undergraduates by bellaire on Sunday February 20, 2011 @01:58PM (#2242674)
Yeah, punctuation, wow. I mean, here's a sierpinski triangle generator:

32.times{|i|i.upto(31){|k|putc~k&i>0?32:35};puts}

Oh, wait. That's Ruby. I meant to say:

<?for($n=33;$k=--$n;print~\xf5)for(;$k;)echo-$n&--$k?~\xdf:~\xdc;

Oh, sorry! That's PHP. My bad... here we go:

print map($%&$_?$":'#',0..~($%=$_)),$/for-32..1

There we go... You're right, Perl is so much worse!

The point is, of course, you can write ugly code in any language, or you can write beautiful code in any language. Python actually is fairly legible nearly all the time...

n=32

while n:print''.join('# '[-n&k>0]for k in range(n));n-=1

but that comes at the cost of added verbosity and reduced flexibility . Whether that's better is a matter of taste, not of fact.

There are no comments on this comment yet.