NAME

FP::Abstract::Sequence - functional sequence protocol

SYNOPSIS

    use FP::Predicates "is_sequence"; # since we can't have it in
                                      # FP::Abstract::Sequence
    use FP::PureArray;
    use FP::StrictList;
    use FP::List;
    use FP::Stream;
    use FP::Array 'array';

    use FP::Equal 'is_equal';

    is_equal list(purearray(3,4),
                  strictlist(3,4),
                  list(3,4),
                  stream(3,4),
                  cons(3,4), # ok this can't really count as a sequence,
                             # what to do about it?
                  array(3,4), # Could `autobox` change this?
                  3,
                  {3=>4})->map(*is_sequence),
             list(1,1,1,1,1,0,0,0);

    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

FP::Abstract::Pure

NOTE

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