line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bubblegum::Object::Role::List; |
2
|
|
|
|
|
|
|
|
3
|
36
|
|
|
36
|
|
16549
|
use 5.10.0; |
|
36
|
|
|
|
|
106
|
|
|
36
|
|
|
|
|
1465
|
|
4
|
36
|
|
|
36
|
|
160
|
use namespace::autoclean; |
|
36
|
|
|
|
|
49
|
|
|
36
|
|
|
|
|
208
|
|
5
|
|
|
|
|
|
|
|
6
|
36
|
|
|
36
|
|
2118
|
use Bubblegum::Role 'requires', 'with'; |
|
36
|
|
|
|
|
54
|
|
|
36
|
|
|
|
|
226
|
|
7
|
36
|
|
|
36
|
|
25801
|
use Bubblegum::Constraints -isas, -types; |
|
36
|
|
|
|
|
1255
|
|
|
36
|
|
|
|
|
439
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'Bubblegum::Object::Role::Value'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.45'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
requires 'defined'; |
14
|
|
|
|
|
|
|
requires 'grep'; |
15
|
|
|
|
|
|
|
requires 'head'; |
16
|
|
|
|
|
|
|
requires 'join'; |
17
|
|
|
|
|
|
|
requires 'length'; |
18
|
|
|
|
|
|
|
requires 'map'; |
19
|
|
|
|
|
|
|
requires 'reverse'; |
20
|
|
|
|
|
|
|
requires 'sort'; |
21
|
|
|
|
|
|
|
requires 'tail'; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub reduce { |
24
|
0
|
|
|
0
|
0
|
|
my $self = CORE::shift; |
25
|
0
|
|
|
|
|
|
my $code = CORE::shift; |
26
|
|
|
|
|
|
|
|
27
|
0
|
0
|
|
|
|
|
$code = $code->codify if isa_string $code; |
28
|
0
|
|
|
|
|
|
type_coderef $code; |
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
|
my $a = [0 .. $#{$self}]; |
|
0
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
|
my $acc = $a->head; |
32
|
0
|
|
|
0
|
|
|
$a->tail->map(sub { $acc = $code->($acc, $_, @_) }); |
|
0
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
|
|
|
return $acc; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub zip { |
38
|
0
|
|
|
0
|
0
|
|
my $self = CORE::shift; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
my $other = type_arrayref CORE::shift; |
41
|
0
|
0
|
|
|
|
|
my $this = $self->length < $other->length ? $other : $self; |
42
|
0
|
|
|
|
|
|
my $a = [0 .. $#{$this}]; |
|
0
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
0
|
|
|
return $this->keys->map(sub { [$self->get($_), $other->get($_)] }); |
|
0
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |