Perl6 vs Ruby: reduce


sum = (1..10).reduce {|x,y| x+y}

or maybe

sum = (1..10).reduce {:+}


my $sum = [+] 1..10;

That has got to be some of the sexiest perl syntax ever!

Posted Wed, Jan 21, 2009

If you're interested in being notified when new posts are published, you can subscribe here; you'll get an email once a week at the most.