Rakudo Perl 6

Jonathan "Duke" Leto got Rakudo Perl 6 working thanks in part to to efforts by Moritz (moritz++) Lenz, of fame, who helped make input arguments work correctly.

Here is an example stored procedure written in PL/Perl 6, from our test suite:

CREATE OR REPLACE FUNCTION test_fibonacci_plperl6(integer) RETURNS int LANGUAGE plperl6 AS $$
    [+] (1, 1, *+* ... $^limit)

The first line is SQL, and everything between the $$ symbols is Perl 6! This stored procedure takes a single integer N and returns the sum of the first N Fibonacci numbers.

The syntax $^limit is called a "placeholder variable."

You can also specifically name your input arguments like this:
CREATE OR REPLACE FUNCTION test_input_3_args(integer, integer, integer)
RETURNS int LANGUAGE plperl6 AS $$
($a, $b, $c) {
    $a - $b + $c
This stored procedure is very simple, but shows how you can directly tell PL/Perl6 the "signature" of your procedure. The signature is the ($a,$b,$c), which tells Rakudo Perl 6 that there are three named arguments. The function body (the parts between the { and the } ) simply takes the difference of the first two arguments and adds the third.