Element definition
With Pair
Pairmy $elem = 42 => $nextelem;With custom type
class Cell {
has $.value is rw;
has Cell $.next is rw;
# ...convenience methods here...
}
sub cons ($value, $next) { Cell.new(:$value, :$next) }
my $list = cons 10, (cons 20, (cons 30, Nil));Last updated