Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[t/spec] replace .batch($x) with .[^$x]

git-svn-id: http://svn.pugscode.org/pugs@31267 c213334d-75ef-0310-aa23-eaa082d1ae64
  • Loading branch information...
commit 9e9686f7ecc162681d76d8280885a7f3f6ea8c03 1 parent e6c9940
moritz authored
View
4 S03-metaops/reduce.t
@@ -188,9 +188,9 @@ is( ([<] 42), Bool::True, "[<] 42 returns true");
is( ~([\<] 42), "1", "[\<] 42 returns '1'");
ok( ([\<] 42) ~~ Iterable, "[\<] 42 returns something Iterable");
-is( ([\*] 1..*).batch(10).join(', '), '1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800',
+is( ([\*] 1..*).[^10].join(', '), '1, 2, 6, 24, 120, 720, 5040, 40320, 362880, 3628800',
'triangle reduce is lazy');
-is( ([\R~] 'a'..*).batch(8).join(', '), 'a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba',
+is( ([\R~] 'a'..*).[^8].join(', '), 'a, ba, cba, dcba, edcba, fedcba, gfedcba, hgfedcba',
'triangle reduce is lazy');
# RT #65164 (TODO: implement [^^])
View
4 S03-metaops/zip.t
@@ -18,8 +18,8 @@ is (1,2 Z* 3,4), (3,8), 'zip-product works';
is (1,2 Zcmp 3,2,0), (-1, 0), 'zip-cmp works';
# tests for laziness
-is (1..* Z** 1..*).batch(5), (1**1, 2**2, 3**3, 4**4, 5**5), 'zip-power with lazy lists';
-is (1..* Z+ (3, 2 ... *)).batch(5), (1+3, 2+2, 3+1, 4+0, 5-1), 'zip-plus with lazy lists';
+is (1..* Z** 1..*).[^5], (1**1, 2**2, 3**3, 4**4, 5**5), 'zip-power with lazy lists';
+is (1..* Z+ (3, 2 ... *)).[^5], (1+3, 2+2, 3+1, 4+0, 5-1), 'zip-plus with lazy lists';
# tests for non-list arguments
is (1 Z* 3,4), (3), 'zip-product works with scalar left side';
View
8 S03-operators/series-arity0.t
@@ -7,7 +7,7 @@ plan *;
# Test with Whatever limit
{
- my @rolls = ({ (1..6).pick } ... *).batch(20);
+ my @rolls = ({ (1..6).pick } ... *).[^20];
is +@rolls, 20, 'Got the number of rolls we asked for';
is @rolls.grep(Int).elems, 20, 'all the rolls are Ints';
is @rolls.grep(1..6).elems, 20, 'all the rolls are in the Range 1..6';
@@ -15,7 +15,7 @@ plan *;
# Test with exact limit
{
- my @rolls = ({ (1..2).pick } ... 2).batch(100);
+ my @rolls = ({ (1..2).pick } ... 2).[^100];
ok +@rolls > 0, 'the series had at least one element...';
ok +@rolls < 100, '... and the series terminated';
is @rolls.grep(Int).elems, +@rolls, 'all the rolls are Ints';
@@ -25,7 +25,7 @@ plan *;
# Test with limit between possible values
{
- my @rolls = ({ (1..2).pick } ... 1.5).batch(100);
+ my @rolls = ({ (1..2).pick } ... 1.5).[^100];
ok +@rolls > 0, 'the series had at least one element...';
ok +@rolls < 100, '... and the series terminated';
is @rolls.grep(Int).elems, +@rolls, 'all the rolls are Ints';
@@ -34,7 +34,7 @@ plan *;
# Test with limit that cannot be hit
{
- my @rolls = ({ (1..6).pick } ... 7).batch(40);
+ my @rolls = ({ (1..6).pick } ... 7).[^40];
is +@rolls, 40, 'Got the number of rolls we asked for';
is @rolls.grep(Int).elems, 40, 'all the rolls are Ints';
is @rolls.grep(1..6).elems, 40, 'all the rolls are in the Range 1..6';
View
22 S03-operators/series-arity2ormore.t
@@ -7,22 +7,22 @@ plan *;
# some tests without regard to ending
-is (1, 1, { $^a + $^b } ... *).batch(6).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
-is (0, 1, { $^a + $^b } ... *).batch(7).join(', '), '0, 1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 0 1 seeds';
-is (1, 1, 2, -> $a, $b { $a + $b } ... *).batch(6).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
-is (1, 1, 2, 3, { $^a + $^b } ... *).batch(6).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
-is (0, 1, 1, 2, 3, { $^a + $^b } ... *).batch(7).join(', '), '0, 1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 5 seeds';
+is (1, 1, { $^a + $^b } ... *).[^6].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
+is (0, 1, { $^a + $^b } ... *).[^7].join(', '), '0, 1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 0 1 seeds';
+is (1, 1, 2, -> $a, $b { $a + $b } ... *).[^6].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
+is (1, 1, 2, 3, { $^a + $^b } ... *).[^6].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
+is (0, 1, 1, 2, 3, { $^a + $^b } ... *).[^7].join(', '), '0, 1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 5 seeds';
# some tests which exactly hit a limit
-is (1, 1, { $^a + $^b } ... 8).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
-is (1, 1, 2, -> $a, $b { $a + $b } ... 8).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
-is (1, 1, 2, 3, { $^a + $^b } ... 8).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
+is (1, 1, { $^a + $^b } ... 8).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
+is (1, 1, 2, -> $a, $b { $a + $b } ... 8).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
+is (1, 1, 2, 3, { $^a + $^b } ... 8).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
# some tests which go past a limit
-is (1, 1, { $^a + $^b } ... 9).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
-is (1, 1, 2, -> $a, $b { $a + $b } ... 9).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
-is (1, 1, 2, 3, { $^a + $^b } ... 9).batch(20).join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
+is (1, 1, { $^a + $^b } ... 9).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci';
+is (1, 1, 2, -> $a, $b { $a + $b } ... 9).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 3 seeds';
+is (1, 1, 2, 3, { $^a + $^b } ... 9).[^20].join(', '), '1, 1, 2, 3, 5, 8', 'arity-2 Fibonacci, 4 seeds';
done_testing;
View
98 S03-operators/series-simple.t
@@ -7,71 +7,71 @@ plan *;
# some tests without regard to ending
-is (1 ... *).batch(5).join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
-is (1, 3 ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
-is (1, 0 ... *).batch(5).join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
-is (1, 3, 5 ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
-is (1, 3, 9 ... *).batch(5).join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
-is (81, 27, 9 ... *).batch(5).join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
-is (1, { $_ + 2 } ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
-is (1, { $_ - 2 } ... *).batch(5).join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
-
-is (1, { 1 / ((1 / $_) + 1) } ... *).batch(5).map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
-is (1, { -$_ } ... *).batch(5).join(', '), '1, -1, 1, -1, 1', 'simple repeating series with one item and closure on the LHS';
+is (1 ... *).[^5].join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
+is (1, 3 ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
+is (1, 0 ... *).[^5].join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
+is (1, 3, 5 ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
+is (1, 3, 9 ... *).[^5].join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
+is (81, 27, 9 ... *).[^5].join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
+is (1, { $_ + 2 } ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
+is (1, { $_ - 2 } ... *).[^5].join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
+
+is (1, { 1 / ((1 / $_) + 1) } ... *).[^5].map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
+is (1, { -$_ } ... *).[^5].join(', '), '1, -1, 1, -1, 1', 'simple repeating series with one item and closure on the LHS';
# some tests which exactly hit a limit
-is (1 ... 5).batch(10).join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
-is (1, 3 ... 9).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
-is (1, 0 ... -3).batch(10).join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
-is (1, 3, 5 ... 9).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
-is (1, 3, 9 ... 81).batch(10).join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
-is (81, 27, 9 ... 1).batch(10).join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
-is (1, { $_ + 2 } ... 9).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
-is (1, { $_ - 2 } ... -7).batch(10).join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
+is (1 ... 5).[^10].join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
+is (1, 3 ... 9).[^10].join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
+is (1, 0 ... -3).[^10].join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
+is (1, 3, 5 ... 9).[^10].join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
+is (1, 3, 9 ... 81).[^10].join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
+is (81, 27, 9 ... 1).[^10].join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
+is (1, { $_ + 2 } ... 9).[^10].join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
+is (1, { $_ - 2 } ... -7).[^10].join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
-is (1, { 1 / ((1 / $_) + 1) } ... 1/5).batch(10).map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
-is (1, { -$_ } ... 1).batch(10).join(', '), '1', 'simple repeating series with one item and closure on the LHS';
-is (1, { -$_ } ... 3).batch(5).join(', '), '1, -1, 1, -1, 1', 'simple repeating series with one item and closure on the LHS';
+is (1, { 1 / ((1 / $_) + 1) } ... 1/5).[^10].map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
+is (1, { -$_ } ... 1).[^10].join(', '), '1', 'simple repeating series with one item and closure on the LHS';
+is (1, { -$_ } ... 3).[^5].join(', '), '1, -1, 1, -1, 1', 'simple repeating series with one item and closure on the LHS';
# some tests which go past a limit
-is (1 ... 5.5).batch(10).join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
-is (1, 3 ... 10).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
-is (1, 0 ... -3.5).batch(10).join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
-is (1, 3, 5 ... 10).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
-is (1, 3, 9 ... 100).batch(10).join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
-is (81, 27, 9 ... 8/9).batch(10).join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
-is (1, { $_ + 2 } ... 10).batch(10).join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
-is (1, { $_ - 2 } ... -8).batch(10).join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
+is (1 ... 5.5).[^10].join(', '), '1, 2, 3, 4, 5', 'simple series with one item on the LHS';
+is (1, 3 ... 10).[^10].join(', '), '1, 3, 5, 7, 9', 'simple additive series with two items on the LHS';
+is (1, 0 ... -3.5).[^10].join(', '), '1, 0, -1, -2, -3', 'simple decreasing additive series with two items on the LHS';
+is (1, 3, 5 ... 10).[^10].join(', '), '1, 3, 5, 7, 9', 'simple additive series with three items on the LHS';
+is (1, 3, 9 ... 100).[^10].join(', '), '1, 3, 9, 27, 81', 'simple multiplicative series with three items on the LHS';
+is (81, 27, 9 ... 8/9).[^10].join(', '), '81, 27, 9, 3, 1', 'decreasing multiplicative series with three items on the LHS';
+is (1, { $_ + 2 } ... 10).[^10].join(', '), '1, 3, 5, 7, 9', 'simple series with one item and closure on the LHS';
+is (1, { $_ - 2 } ... -8).[^10].join(', '), '1, -1, -3, -5, -7', 'simple series with one item and closure on the LHS';
-is (1, { 1 / ((1 / $_) + 1) } ... 11/60).batch(10).map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
-is (1, { -$_ } ... 0).batch(10).join(', '), '1', 'simple repeating series with one item and closure on the LHS';
+is (1, { 1 / ((1 / $_) + 1) } ... 11/60).[^10].map({.perl}).join(', '), '1, 1/2, 1/3, 1/4, 1/5', 'tricky series with one item and closure on the LHS';
+is (1, { -$_ } ... 0).[^10].join(', '), '1', 'simple repeating series with one item and closure on the LHS';
# some tests taken from Spec
-is (<a b c>, {.succ } ... *).batch(10).join(', '), "a, b, c, d, e, f, g, h, i, j", "string-valued series staring from array and with explicit .succ";
+is (<a b c>, {.succ } ... *).[^10].join(', '), "a, b, c, d, e, f, g, h, i, j", "string-valued series staring from array and with explicit .succ";
is (0,2,4, { $_ + 2 } ... 42).join(', '), (0..42).grep({$_ !% 2}).join(', '), "evens starting with three values and closure";
#?rakudo 2 skip '&prefix:<!> does not work with series yet'
-is (False, &prefix:<!> ... *).batch(10).join(', '), "0, 1, 0, 1, 0, 1, 0, 1, 0, 1", "alternating False and True";
-is (False, &prefix:<!> ... *).batch(10).grep(Bool).elems, 10, "alternating False and True is always Bool";
-is (False, { !$_ } ... *).batch(10).join(', '), "0, 1, 0, 1, 0, 1, 0, 1, 0, 1", "alternating False and True";
-is (False, { !$_ } ... *).batch(10).grep(Bool).elems, 10, "alternating False and True is always Bool";
+is (False, &prefix:<!> ... *).[^10].join(', '), "0, 1, 0, 1, 0, 1, 0, 1, 0, 1", "alternating False and True";
+is (False, &prefix:<!> ... *).[^10].grep(Bool).elems, 10, "alternating False and True is always Bool";
+is (False, { !$_ } ... *).[^10].join(', '), "0, 1, 0, 1, 0, 1, 0, 1, 0, 1", "alternating False and True";
+is (False, { !$_ } ... *).[^10].grep(Bool).elems, 10, "alternating False and True is always Bool";
# tests for strange cases
-is (1, 1, 1 ... 10).batch(10).join(', '), '1, 1, 1, 1, 1, 1, 1, 1, 1, 1', 'series started with three identical numbers';
-is (1, 1, 1, 2, 3 ... 10).batch(10).join(', '), '1, 1, 1, 2, 3, 4, 5, 6, 7, 8', 'series started with three identical numbers, but then goes arithmetic';
-is (1, 1, 1, 2, 4 ... 16).batch(10).join(', '), '1, 1, 1, 2, 4, 8, 16', 'series started with three identical numbers, but then goes geometric';
-is (4, 2, 1, 2, 4 ... 16).batch(10).join(', '), '4, 2, 1, 2, 4, 8, 16', 'series started with three identical numbers, but then goes geometric';
-is ('a', 'b' ... *).batch(10).join(', '), 'a, b, c, d, e, f, g, h, i, j', 'series started with two different letters';
-is (<a b c> ... *).batch(10).join(', '), "a, b, c, d, e, f, g, h, i, j", "string-valued series staring from array";
-is ('z' ... 'a').batch(10).join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with one letter';
-is (<z y> ... 'a').batch(10).join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with two different letters';
-is (<z y x> ... 'a').batch(10).join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with two different letters';
+is (1, 1, 1 ... 10).[^10].join(', '), '1, 1, 1, 1, 1, 1, 1, 1, 1, 1', 'series started with three identical numbers';
+is (1, 1, 1, 2, 3 ... 10).[^10].join(', '), '1, 1, 1, 2, 3, 4, 5, 6, 7, 8', 'series started with three identical numbers, but then goes arithmetic';
+is (1, 1, 1, 2, 4 ... 16).[^10].join(', '), '1, 1, 1, 2, 4, 8, 16', 'series started with three identical numbers, but then goes geometric';
+is (4, 2, 1, 2, 4 ... 16).[^10].join(', '), '4, 2, 1, 2, 4, 8, 16', 'series started with three identical numbers, but then goes geometric';
+is ('a', 'b' ... *).[^10].join(', '), 'a, b, c, d, e, f, g, h, i, j', 'series started with two different letters';
+is (<a b c> ... *).[^10].join(', '), "a, b, c, d, e, f, g, h, i, j", "string-valued series staring from array";
+is ('z' ... 'a').[^10].join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with one letter';
+is (<z y> ... 'a').[^10].join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with two different letters';
+is (<z y x> ... 'a').[^10].join(', '), 'z, y, x, w, v, u, t, s, r, q', 'descending series started with two different letters';
# tests for repetition
-is ('c', { $_ } ... *).batch(10).join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with letter and identify closure';
-is ('c', 'c' ... *).batch(10).join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with two identical letters';
-is ('c', 'c', 'c' ... *).batch(10).join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with three identical letters';
+is ('c', { $_ } ... *).[^10].join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with letter and identify closure';
+is ('c', 'c' ... *).[^10].join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with two identical letters';
+is ('c', 'c', 'c' ... *).[^10].join(', '), 'c, c, c, c, c, c, c, c, c, c', 'series started with three identical letters';
# tests for alphabetical series crossing 'z'
#?rakudo 1 todo "RT#74990: Series of letters doesn't stop at end point"
View
32 S03-operators/series.t
@@ -27,17 +27,17 @@ is (1, 1, { $^x + $^y } ... 13).join(', '), '1, 1, 2, 3, 5, 8, 13', 'limited fib
is gcd(42, 24), 6, 'gcd with infix:<...> (2)';
}
-is (1 ... *).batch(5).join(', '), '1, 2, 3, 4, 5', 'lazy series with one item on the LHS';
-is (1, 3 ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'lazy additive series with two items on the LHS';
-is (1, 3, 5 ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'lazy additive series with three items on the LHS';
-is (1, 3, 9 ... *).batch(5).join(', '), '1, 3, 9, 27, 81', 'lazy multiplicative series with three items on the LHS';
-is (1, 1 ... *).batch(5).join(', '), '1, 1, 1, 1, 1', 'lazy "additive" series with two items on the LHS';
-is (1, 1, 1 ... *).batch(5).join(', '), '1, 1, 1, 1, 1', 'lazy "additive" series with three items on the LHS';
-is (1, { $_ + 2 } ... *).batch(5).join(', '), '1, 3, 5, 7, 9', 'lazy series with one item and arity-1 closure on the LHS';
-
-is (1, 1, { $^x + $^y } ... *).batch(7).join(', '), '1, 1, 2, 3, 5, 8, 13', 'infinite fibonacci generator';
+is (1 ... *).[^5].join(', '), '1, 2, 3, 4, 5', 'lazy series with one item on the LHS';
+is (1, 3 ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'lazy additive series with two items on the LHS';
+is (1, 3, 5 ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'lazy additive series with three items on the LHS';
+is (1, 3, 9 ... *).[^5].join(', '), '1, 3, 9, 27, 81', 'lazy multiplicative series with three items on the LHS';
+is (1, 1 ... *).[^5].join(', '), '1, 1, 1, 1, 1', 'lazy "additive" series with two items on the LHS';
+is (1, 1, 1 ... *).[^5].join(', '), '1, 1, 1, 1, 1', 'lazy "additive" series with three items on the LHS';
+is (1, { $_ + 2 } ... *).[^5].join(', '), '1, 3, 5, 7, 9', 'lazy series with one item and arity-1 closure on the LHS';
+
+is (1, 1, { $^x + $^y } ... *).[^7].join(', '), '1, 1, 2, 3, 5, 8, 13', 'infinite fibonacci generator';
#?rakudo skip "Symbol '&infix:<+>' not predeclared in <anonymous>"
-is (1, 1, &infix:<+> ... *).batch(7).join(', '), '1, 1, 2, 3, 5, 8, 13', 'infinite fibonacci generator';
+is (1, 1, &infix:<+> ... *).[^7].join(', '), '1, 1, 2, 3, 5, 8, 13', 'infinite fibonacci generator';
#?rakudo skip "state NYI"
{
@@ -61,13 +61,13 @@ is (1, 1, &infix:<+> ... *).batch(7).join(', '), '1, 1, 2, 3, 5, 8, 13', 'infini
is @primes[5], 13, 'prime generator with series op works (0)';
}
-is ('a' ... *).batch(7).join(', '), 'a, b, c, d, e, f, g', 'string from single generator';
-is (<a b> ... *).batch(7).join(', '), 'a, b, c, d, e, f, g', 'string from double generator';
-is (<a b>, { .succ } ... *).batch(7).join(', '), 'a, b, c, d, e, f, g', 'string and arity-1';
+is ('a' ... *).[^7].join(', '), 'a, b, c, d, e, f, g', 'string from single generator';
+is (<a b> ... *).[^7].join(', '), 'a, b, c, d, e, f, g', 'string from double generator';
+is (<a b>, { .succ } ... *).[^7].join(', '), 'a, b, c, d, e, f, g', 'string and arity-1';
-is (8, 7 ... *).batch(5).join(', '), '8, 7, 6, 5, 4', 'arith decreasing';
-is (8, 7, 6 ... *).batch(5).join(', '), '8, 7, 6, 5, 4', 'arith decreasing';
-is (16, 8, 4 ... *).batch(5).join(', '), '16, 8, 4, 2, 1', 'geom decreasing';
+is (8, 7 ... *).[^5].join(', '), '8, 7, 6, 5, 4', 'arith decreasing';
+is (8, 7, 6 ... *).[^5].join(', '), '8, 7, 6, 5, 4', 'arith decreasing';
+is (16, 8, 4 ... *).[^5].join(', '), '16, 8, 4, 2, 1', 'geom decreasing';
View
2  S32-list/pick.t
@@ -52,7 +52,7 @@ is (<a b c d>.pick(*).sort).Str, 'a b c d', 'pick(*) returns all the items in th
'pick(*) returned the items of the array in a random order');
}
-is (0, 1).pick(*, :replace).batch(10).elems, 10, '.pick(*, :replace) returns an answer';
+is (0, 1).pick(*, :replace).[^10].elems, 10, '.pick(*, :replace) returns an answer';
{
# Test that List.pick doesn't flatten array refs
Please sign in to comment.
Something went wrong with that request. Please try again.