One thing to note is that infix:<**> (and also the hypered version of it) has a 
tighter precedence than the range operator. Therefore we need parenthesis to 
get the expected result. (Using a range there works now).

$ perl6-m -e 'say 1 <<**<< (1 .. 4)'
(10 100 1000 10000)

$ perl6 -e 'say 10 <<**<< 1 .. 4'
10..4

$ perl6 -e 'say (10 <<**<< 1) .. 4'
10..4

The thighter precedence was also behind the "incorrect" output of the compound 
example:

$ perl6 -e 'my $base = 10; my %bases = <K M G T> Z=> ( $base <<**<< 1..* ); say 
%bases'
G => 12, K => 10, M => 11, T => 13

... which is the same as

$ perl6 -e 'my $base = 10; my %bases = <K M G T> Z=> ( ($base <<**<< 1) .. * ); 
say %bases'
G => 12, K => 10, M => 11, T => 13

Using parenthesis around the infinite range fails with X::HyperOp::Infinite:

$ perl6 -e 'my $base = 10; my %bases = <K M G T> Z=> ( $base <<**<< (1 .. *) ); 
say %bases'
List on right side of hyperop of infix:<**> is known to be infinite
  in block <unit> at -e:1

But using a finite range works:

$ perl6 -e 'my $base = 10; my %bases = <K M G T> Z=> ( $base <<**<< (1 .. 4) ); 
say %bases'
G => 1000, K => 10, M => 100, T => 10000

I added three tests to S03-metaops/hyper.t with commit 
https://github.com/perl6/roast/commit/0e4520aff9.

I'm closing this ticket as 'resolved'.

Reply via email to