No description, website, or topics provided.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib/My
t
README.pod

README.pod

NAME

My::List

SYNOPSIS

use My::List;

my $list = My::List->new(1, 2, 3); # -> My::List(1, My::List(2, My::List(3, My::List->nil)))

$list->map(sub { $_[0] * 2 }); # -> My::List(2, My::List(4, My::List(6, My::List->nil)))

$list->reduce(sub { $_[0] + $_[1] }, 0); # -> 6

$list->each(sub { print $_[0], "\n" });
# 1
# 2
# 3

my $appended = $list->link(4, 5, 6);
# -> My::List(1, My::List(2, My::List(3, My::List(4, My::List(5, My::List(6, My::List->nil))))))
$appended->each(sub { print $_[0], "\n" });
# 1
# 2
# 3
# 4
# 5
# 6

# External Iterator
my $iterator = $list->iterator;

print $iterator->next, "\n" while $iterator->has_next;
# 1
# 2
# 3

DESCRIPTION

Yet another linked-list implementation.

This works is for learning Perl.

SEE ALSO

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.