FP::MutableArray
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, '' );
Native Perl arrays but blessed so that they can follow the sequences protocol.
Implements: FP::Abstract::Sequence, FP::Abstract::Equal, FP::Abstract::Show
FP::PureArray, FP::Array
This is alpha software! Read the status section in the package README or on the website.
To install FunctionalPerl, copy and paste the appropriate command in to your terminal.
cpanm
cpanm FunctionalPerl
CPAN shell
perl -MCPAN -e shell install FunctionalPerl
For more information on module installation, please visit the detailed CPAN module installation guide.