blib/lib/Dallycot/Library/Core/Streams.pm

filter: Statementstmt 100% 27 / 27 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 100% 33 / 33 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« blib/lib/Dallycot/Library/Core.pm ↑ Summary blib/lib/Dallycot/Processor/XS.pm »
1 package Dallycot::Library::Core::Streams;
2 9 our $AUTHORITY = 'cpan:JSMITH';
3  
4 # ABSTRACT: Core library of useful streams and stream functions
5  
6 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 9 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use Dallycot::Library;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 9 ▶use Dallycot::Library::Core ();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 9 ▶use Dallycot::Library::Core::Math ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 9 ns 'http://www.dallycot.net/ns/streams/1.0#';
16  
17 9 uses 'http://www.dallycot.net/ns/core/1.0#', 'http://www.dallycot.net/ns/loc/1.0#';
18  
19 9 define 'set-first' => '(s, sh) :> [sh, s... ]';
20  
21 9 define 'set-rest' => "(s, st) :> [ s', st ]";
22  
23 9 define 'insert-after' => "(s, m) :> [ s', m, s... ]";
24  
25 9 define downfrom => '(n) :> (n..0)';
26  
27 # define downfrom => <<'EOD';
28 # y-combinator(
29 # (self, n) :> (
30 # (n > 0) : [ n, ff(ff, n - 1) ]
31 # (n = 0) : [ 0 ]
32 # ( ) : [ ]
33 # )
34 # )
35 # EOD
36  
37 9 define 'last' => <<'EOD';
38 y-combinator(
39 (self, stream) :> (
40 (?(stream...)) : self(self, stream...)
41 ( ) : stream'
42 )
43 )
44 EOD
45  
46 9 1;
« blib/lib/Dallycot/Library/Core.pm ↑ Summary blib/lib/Dallycot/Processor/XS.pm »