NAME
FP::Abstract::Sequence - functional sequence protocol
SYNOPSIS
# ^ placed here because we can't export functions from
# FP::Abstract::Sequence
use
FP::PureArray;
use
FP::StrictList;
use
FP::List;
use
FP::Stream;
is_equal list(purearray(3, 4),
strictlist(3, 4),
list(3, 4),
stream(3, 4),
cons(3, 4),
array(3, 4),
# Should we change this given `FP::autobox`?
3,
{
3
=> 4})->
map
(\
&is_sequence
),
list(1, 1, 1, 1, 1,
undef
,
undef
,
undef
);
is is_sequence(cons 3, 4), 1;
is is_proper_sequence(cons 3, 4), 0;
# improper list
my
$ns
= purearray(FP::Abstract::Sequence->FP_Interface__method_names);
# The methods you can count on being supported by sequences.
is_equal
$ns
->
sort
->take(5),
purearray(
'any'
,
'append'
,
'array'
,
'cons'
,
'drop'
);
DESCRIPTION
This is a functional protocol, i.e. its use does not exert any side effects (that are visible to the user). It does *not* imply `FP::Abstract::Pure`, though; impure data structures could implement it all the same (in addition to a mutation protocol).
SEE ALSO
NOTE
This is alpha software! Read the status section in the package README or on the website.