The Beauty of a Perl Quicksort

Yet Another Misleading Title. :)

err...I have to say, (I can't remember the exact time I met this version of quicksort), ever since the Haskell version was born, there were (and still are) various implementations available in various languages. This version of quicksort is a very nature "translation" of what the algorithm is:

function quicksort(list) {
    select a pivot;
    return (quicksort([x|x<pivot]), pivot, quicksort([x|x>pivot]));

Today, I met this version again in ="…

Yet Another Post on "Pascal Triangle"

又名:如何用一行Perl 6打印杨辉三角前n行。

此时开始到目前为止,网上至少有三篇关于如何用Perl 6打印杨辉三角的文章:这里(TimToady), 这里(Moritz), 和 这里(Masak)。

"There's more than one way to do it.",好…

公告:Rakudo Star - 一个可用、实用的Perl 6早期发行版


原文链接: Announce: Rakudo Star - a useful, usable, "early adopter" distribution of Perl 6


我谨代表Rakudo以及Perl 6开发团队高兴地向各位宣布Rakudo Star ── 一个可用、实用Perl 6早期发行版已于2010年7月发布。该发行版的tar源码包可以从 下载。

Rakudo Star 着重打造Perl 6的一个尝鲜版本。我们知…

Read (the perldoc) carefully

Another day in CGI/CGI::Application brought me another question.

My code:

    ... ...
    $out .= $cgi->hidden('rm', 'mode2');
    ... ...
    return $out;

Seems to be OK, just like the example code below, a little bit different though:

$output .= $q->hidden(-name => 'rm', -value => 'mode2');

And if I use a URL like this: "…

The last statement

Days ago, I was learning to use CGI::Application.

After finished my baby "run mode", I opened my browser to give it a shot. It worked, and I start wondering why it worked. The last statements of those examples are

return $output;

Mine's not, it looked like this(I forgot to add "return" by accident):

sub run_mode_1 {
    my $self   = shift;
    my $query  = $self->query();
    my $output = q[];
    ... …