> On 13 Mar 2015, at 08:32, H. Merijn Brand (via RT) 
> <perl6-bugs-follo...@perl.org> wrote:
> 
> # New Ticket Created by  H. Merijn Brand 
> # Please include the string:  [perl #124059]
> # in the subject line of all future correspondence about this issue. 
> # <URL: https://rt.perl.org/Ticket/Display.html?id=124059 >
> 
> 
> $ perl6 -e'(1,4..7,9..Inf).perl.say'
> (1, 4..7, 9..Inf)
> $ perl6
> -e'my@x=1;my$x=4;@x.push($x..7);$x=9;@x.push($x..Inf);@x.perl.say'
> Cannot .push an infinite list
>  in block <unit> at -e:1

This is correct.


> $ perl6
> -e'my@x=1;my$x=4;@x.plan($x..7);$x=9;@x.plan($x..Inf);@x.perl.say'
> -- time passes
> ^C

The hanging is caused by .perl being eager trying to generate the string that 
represents the infinite list.


> $ perl6 -e'my@x=1,2,3;@x.plan("a"..*);@x.perl.say'
> -- time passes
> ^C

Same here.


> <TimToady> m: my @x = 1,2,3; @x.plan('a'..*); say @x
> <camelia> rakudo-moar 076da8: OUTPUT«1 2 3 a b c d e f g h i j k l m n o p q 
> r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar as at 
> au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br bs bt 
> bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl cm cn …»
> <TimToady> m: my @x = 1,2,3; @x.plan(7,8,9); @x.plan('a'..*); say @x
> <camelia> rakudo-moar 076da8: OUTPUT«1 2 3 7 8 9 a b c d e f g h i j k l m n 
> o p q r s t u v w x y z aa ab ac ad ae af ag ah ai aj ak al am an ao ap aq ar 
> as at au av aw ax ay az ba bb bc bd be bf bg bh bi bj bk bl bm bn bo bp bq br 
> bs bt bu bv bw bx by bz ca cb cc cd ce cf cg ch ci cj ck cl …»
> <TimToady> yeah, better RT that

[08:47:09]  <[Tux]>     lizmat, what, in your opinion, is the correct way to 
dynamically build (1, 4..7, 9..Inf)?
[08:48:14]  <lizmat>    m: my @x = 1; @x.plan(4..7); @x.plan(9..Inf); say 
@x[^10]
[08:48:14]  <+camelia>  rakudo-moar 0a8bdf: OUTPUT«1 4 5 6 7 9 10 11 12 13␤»
[08:48:53]  <[Tux]>     but I want to use @x as a subscript in @y[@x]
[08:50:03]  <lizmat>    m: my @y = ^20; my @x = 1; @x.plan(4..7); 
@x.plan(9..Inf); say @y[@x]  # not seeing the problem
[08:50:03]  <+camelia>  rakudo-moar 0a8bdf: OUTPUT«1 4 5 6 7 9 10 11 12 13 14 
15 16 17 18 19␤»
[08:50:43]  <[Tux]>     hmm, so only using .perl on that is something to rather 
not do
[08:52:04]  <lizmat>    [Tux]: yes, because .perl is by definition eager


I think this ticket can be closed.



Liz

Reply via email to