NAME

List::Rubyish::Circular - A circular list implementation based on List::Rubyish

SYNOPSIS

use Test::More; use List::Rubyish::Circular;

my $list = List::Rubyish::Circular->new(qw(jkondo reikon cinnamon));

is_deeply [qw(reikon cinnamon jkondo)], $list->cycle->to_a; is_deeply [qw(cinnamon jkondo reikon)], $list->cycle(2)->to_a;

is_deeply [qw(cinnamon jkondo reikon)], $list->rcycle->to_a; is_deeply [qw(reikon cinnamon jkondo)], $list->rcycle(2)->to_a;

$list is still a circular list after destracive operation

$list->push(qw(tokky));

is_deeply [qw(jkondo reikon cinnamon tokky)], $list->to_a; is_deeply [qw(reikon cinnamon tokky jkondo)], $list->cycle->to_a; is_deeply [qw(cinnamon tokky jkondo reikon)], $list->rcycle(2)->to_a;

DESCRIPTION

List::Rubyish::Circular is a cirlular list implementation besed on List::Rubyish, so that You can utilize some convenient methods from List::Rubyish against a circular list.

METHODS

cycle ( I<$count> )

Shifts list to the left according to $count and returns new list $count. If $count not passed in, its value is 1.

my $list = List::Rubyish::Circular->new(qw(jkondo reikon cinnamon));

is_deeply [qw(reikon cinnamon jkondo)], $list->cycle->to_a; is_deeply [qw(cinnamon jkondo reikon)], $list->cycle(2)->to_a;

rcycle ( I<$count> )

The opposite of cycle.

SEE ALSO

AUTHOR

Kentaro Kuribayashi kentarok@gmail.com

SEE ALSO

LICENSE

Copyright (C) Kentaro Kuribayashi

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