Raku

Rakudo

Installation

Ubuntu
apt install rakudo
Arch Linux
yay -S rakudo

Examples

Fibonacci Numbers
# Fibonacci Numbers
sub fib ($n)
{
    if ($n < 2) {
        return $n;
    } else {
        return fib( $n - 2 ) + fib( $n - 1 );
    }
}

my $ARGV = @*ARGS.shift;

print fib($ARGV);

=pod
example
    rakudo fib.raku 30
=cut

infinite list

# Fibonacci Numbers
sub fib ($n)
{
    if ($n == 0) {
        return 0;
    } else {
        return (0, 1, * + * ...*)[^$n + 1].tail;
    }
}

my $ARGV = @*ARGS.shift;

print fib($ARGV);

=pod
example
    rakudo fib.raku 39
=cut