NAME

FP::MutableArray

SYNOPSIS

use FP::MutableArray;
use FP::Div 'inc';

my $a = mutablearray(1,4,5)->map(\&inc);
is $a->sum, 13;
$a->[0]++;
is $a->sum, 14;

# They can be turned into immutable ones:
my $b = $a->pure;
like( (eval { $b->[0]++; 1 } || $@),
      qr/^Modification of a read-only value attempted/);

# Although this really consumes the original array, which is now
# immutable, too:
like( (eval { $a->[0]++; 1 } || $@),
      qr/^Modification of a read-only value attempted/);

is $a->sum, 14;

is( FP::_::MutableArray->null == FP::_::MutableArray->null, '' );

DESCRIPTION

Native Perl arrays but blessed so that they can follow the sequences protocol.

SEE ALSO

Implements: FP::Abstract::Sequence, FP::Abstract::Equal, FP::Abstract::Show

FP::PureArray, FP::Array

NOTE

This is alpha software! Read the status section in the package README or on the website.