- or download this
sub fib {
my $nth = shift;
return $nth if $nth <= 1;
return fib( $nth - 1 ) + fib( $nth - 2 );
}
- or download this
sub fib {
croak("…") if @_ != 1;
...
return $nth if $nth <= 1;
return fib( $nth - 1 ) + fib( $nth - 2 );
}
- or download this
sub fib(UInt $nth) {
return $nth if $nth <= 1;
return fib( $nth - 1 ) + fib( $nth - 2 )
}
- or download this
class Point
attr_accessor :x
...
return Point.new @y, @x
end
end
- or download this
class Point {
public $x, $y;
...
}
}
- or download this
class Point:
def __init__(self, x, y):
...
def inverted(self):
return Point(self.y,self.x)
- or download this
package Point;
use Carp 'croak';
...
}
1;
- or download this
class Point {
has Num ($x, $y);
...
return Point->new( x => $y, y => $x );
}
}
- or download this
class Cache::LRU {
use Hash::Ordered;
...
return $x->set( $key, $x->delete($key) );
}
}
- or download this
package Cache::LRU {
use Hash::Ordered;
...
__PACKAGE__->meta->make_immutable;
}