Skip to content

Commit

Permalink
Clarify the status of "pairup"
Browse files Browse the repository at this point in the history
And add tests
  • Loading branch information
lizmat committed May 31, 2024
1 parent 6c53d3f commit bafba00
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ pairs

**Status**: an optimized version of the [`.pairs`](https://docs.raku.org/type/List#routine_pairs) method has been implemented.

pairup
------

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

permutations
------------

Expand Down
7 changes: 7 additions & 0 deletions doc/ParaSeq.rakudoc
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,13 @@ B<Status>: an optimized version of the
L<C<.pairs>|https://docs.raku.org/type/List#routine_pairs> method
has been implemented.

=head2 pairup

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

=head2 permutations

L<C<.permutations>|https://docs.raku.org/type/List#routine_permutations>
Expand Down
2 changes: 1 addition & 1 deletion lib/ParaSeq.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,7 @@ class ParaSeq does Sequence {
}

multi method pairup(ParaSeq:D:) {
self!pass-the-chain: self.Seq.pairup.iterator
self!pass-the-chain: self.List.pairup.iterator
}

proto method permutations(|) {*}
Expand Down
17 changes: 17 additions & 0 deletions t/39-pairup.rakutest
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
use Test;
use ParaSeq;

plan 4;

my constant $elems = 200000;
my constant @list = (^$elems).List;
my constant @pairedup = @list.pairup.List;
my constant $batch = 16;

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

# vim: expandtab shiftwidth=4

0 comments on commit bafba00

Please sign in to comment.