From faaa8d72c28fb8a9b4641706f22a7184dd44e022 Mon Sep 17 00:00:00 2001 From: Elizabeth Mattijsen Date: Fri, 31 May 2024 18:56:25 +0200 Subject: [PATCH] Clarify the status of "produce" And add tests --- Changes | 1 + README.md | 2 +- doc/ParaSeq.rakudoc | 5 ++++- t/42-produce.rakutest | 17 +++++++++++++++++ 4 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 t/42-produce.rakutest diff --git a/Changes b/Changes index f53cdae..c585e1e 100644 --- a/Changes +++ b/Changes @@ -8,6 +8,7 @@ Revision history for ParaSeq - Updated status of ".flat" and added tests - Updated status of ".invert" and added tests - Updated status of ".permutations" and added tests + - Updated status of ".produce" and added tests 0.0.7 2024-05-30T14:24:50+02:00 - Added optimized ".batch" and tests diff --git a/README.md b/README.md index 4614a37..8287452 100644 --- a/README.md +++ b/README.md @@ -295,7 +295,7 @@ pick produce ------- -[`.produce`](https://docs.raku.org/type/Any#routine_produce) +**Status**: the nature of the [`.produce`](https://docs.raku.org/type/Any#routine_produce) method basically makes it impossible to hyper. Therefore, **no** specific hypering logic has been added for this method. repeated -------- diff --git a/doc/ParaSeq.rakudoc b/doc/ParaSeq.rakudoc index 6fd766e..f165837 100644 --- a/doc/ParaSeq.rakudoc +++ b/doc/ParaSeq.rakudoc @@ -369,7 +369,10 @@ hypering logic has been added for this method. =head2 produce -L|https://docs.raku.org/type/Any#routine_produce> +B: the nature of the +L|https://docs.raku.org/type/Any#routine_produce> method +basically makes it impossible to hyper. Therefore, B specific +hypering logic has been added for this method. =head2 repeated diff --git a/t/42-produce.rakutest b/t/42-produce.rakutest new file mode 100644 index 0000000..3a7ad7a --- /dev/null +++ b/t/42-produce.rakutest @@ -0,0 +1,17 @@ +use Test; +use ParaSeq; + +plan 4; + +my constant $elems = 200000; +my constant @list = (^$elems).List; +my constant @produced = @list.produce(&[+]).List; +my constant $batch = 16; + +for 1, ParaSeq.default-degree { + my $seq := @list.&hyperize($batch, $_).produce(&[+]); + isa-ok $seq, $_ == 1 ?? Seq !! ParaSeq; + is-deeply $seq.List, @produced, ".produce(&[+]) with degree = $_"; +} + +# vim: expandtab shiftwidth=4