On Mon, Dec 27, 2010 at 18:18, Daniel Carrera <dcarr...@gmail.com> wrote:
> On Mon, Dec 27, 2010 at 10:03 PM, Moritz Lenz wrote:
>
>> or
>>
>> my $closure = $r1 > $r2 ?? { %matches{$p1}++ } !! { %matches{$p2}++ };
>> # invoke it
>> $closure();
>>
>
>
> That's very cool. Perl 6 is a functional language with lambdas and
> everything.
>
> Daniel.
> --
> No trees were destroyed in the generation of this email, but a large number
> of electrons were severely inconvenienced.
>

Perl 5 has lambdas as well:

my $lambda = sub { print "hello $_[0]\n"; };

$lambda->("world");

Perl 6 just has lots of short cuts that make them nicer.  Like the ^ twigil:

my $lambda = { say "hello $^name" };

$lambda("world");



-- 
Chas. Owens
wonkden.net
The most important skill a programmer can have is the ability to read.

Reply via email to