Skip to content

Commit

Permalink
Clarify the status of "slice"
Browse files Browse the repository at this point in the history
And add tests
  • Loading branch information
lizmat committed May 31, 2024
1 parent faaa8d7 commit 642c9a8
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 1 deletion.
1 change: 1 addition & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Revision history for ParaSeq
- Updated status of ".invert" and added tests
- Updated status of ".permutations" and added tests
- Updated status of ".produce" and added tests
- Updated status of ".slice" and added tests

0.0.7 2024-05-30T14:24:50+02:00
- Added optimized ".batch" and tests
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ rotor
slice
-----

[`.slice`](https://docs.raku.org/type/Seq#multi_method_slice)
**Status**: the nature of the [`.slice`](https://docs.raku.org/type/Seq#multi_method_slice) method basically makes it impossible to hyper. Therefore, **no** specific hypering logic has been added for this method.

snitch
------
Expand Down
3 changes: 3 additions & 0 deletions doc/ParaSeq.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,10 @@ have no specific hypering logic.

=head2 slice

B<Status>: the nature of the
L<C<.slice>|https://docs.raku.org/type/Seq#multi_method_slice>
method basically makes it impossible to hyper. Therefore, B<no>
specific hypering logic has been added for this method.

=head2 snitch

Expand Down
18 changes: 18 additions & 0 deletions t/43-slice.rakutest
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use Test;
use ParaSeq;

plan 4;

my constant $elems = 2_000_000;
my constant @list = (^$elems).List;
my constant $slicer = 1,2,4...*;
my constant @sliced = @list.slice($slicer).List;
my constant $batch = 16;

for 1, ParaSeq.default-degree {
my $seq := @list.&hyperize($batch, $_).slice($slicer);
isa-ok $seq, $_ == 1 ?? Seq !! ParaSeq;
is-deeply $seq.List, @sliced, ".slice with degree = $_";
}

# vim: expandtab shiftwidth=4

0 comments on commit 642c9a8

Please sign in to comment.