Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Range.pick and .roll are expected to return a Seq per GLR
We return a Seq now to avoid unnecessary copying and storing in cases where we
just iterate over the results once.
  • Loading branch information
niner committed Aug 25, 2015
1 parent 21d17ec commit d2a3cfc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions S02-types/range.t
Expand Up @@ -173,7 +173,7 @@ is(+Range, 0, 'type numification');
isa-ok (1..100).pick, Int, "picking a single element from an range of Ints produces an Int";
ok (1..100).pick ~~ 1..100, "picking a single element from an range of Ints produces one of them";

isa-ok (1..100).pick(1), List, "picking 1 from an range of Ints produces a List";
isa-ok (1..100).pick(1), Seq, "picking 1 from an range of Ints produces a Seq";
ok (1..100).pick(1)[0] ~~ 1..100, "picking 1 from an range of Ints produces one of them";

my @c = (1..100).pick(2);
Expand All @@ -200,7 +200,7 @@ is(+Range, 0, 'type numification');
isa-ok ('b' .. 'y').pick, Str, "picking a single element from an range of Strs produces an Str";
ok ('b' .. 'y').pick ~~ 'b' .. 'y', "picking a single element from an range of Strs produces one of them";

isa-ok ('b' .. 'y').pick(1), List, "picking 1 from an range of Strs produces a List";
isa-ok ('b' .. 'y').pick(1), Seq, "picking 1 from an range of Strs produces a Seq";
ok ('b' .. 'y').pick(1)[0] ~~ 'b' .. 'y', "picking 1 from an range of Strs produces one of them";

my @c = ('b' .. 'y').pick(2);
Expand All @@ -227,7 +227,7 @@ is(+Range, 0, 'type numification');
isa-ok (1..100).roll, Int, "rolling a single element from an range of Ints produces an Int";
ok (1..100).roll ~~ 1..100, "rolling a single element from an range of Ints produces one of them";

isa-ok (1..100).roll(1), List, "rolling 1 from an range of Ints produces a List";
isa-ok (1..100).roll(1), Seq, "rolling 1 from an range of Ints produces a Seq";
ok (1..100).roll(1)[0] ~~ 1..100, "rolling 1 from an range of Ints produces one of them";

my @c = (1..100).roll(2);
Expand All @@ -253,7 +253,7 @@ is(+Range, 0, 'type numification');
isa-ok ('b' .. 'y').roll, Str, "rolling a single element from an range of Strs produces an Str";
ok ('b' .. 'y').roll ~~ 'b' .. 'y', "rolling a single element from an range of Strs produces one of them";

isa-ok ('b' .. 'y').roll(1), List, "rolling 1 from an range of Strs produces a List";
isa-ok ('b' .. 'y').roll(1), Seq, "rolling 1 from an range of Strs produces a Seq";
ok ('b' .. 'y').roll(1)[0] ~~ 'b' .. 'y', "rolling 1 from an range of Strs produces one of them";

my @c = ('b' .. 'y').roll(2);
Expand Down

0 comments on commit d2a3cfc

Please sign in to comment.