The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

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 Chj::TEST;

 TEST { 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)->array }
  [ 1,1,1,1,1,'','','' ];

DESCRIPTION

FP sequences are pure (no mutation is allowed, either by force (immutability) or by convention (don't offer mutating accessors, remind users not to mutate)).

XX This is a work in progress. More base implementations should be moved here, etc.

Also, methods that are only implemented here are inconsistent in that they can't be imported as functions from any module. Should we really move functions over as plain wrappers across method calls (only?). Although perhaps it's fair to (only) have those functions importable under a type specific name that have type specific implementations.