Hi
Am 10.02.2014 14:19, schrieb Kamil Kułaga:
> Hi,
>
> I've played wit x and xx repetition operators and found interesting result 
> using
> rakudo star:
>
>> join("|", (1,2) x 10)
> 1 21 21 21 21 21 21 21 21 21 2
>
> Is this ok? If true please explain this to me :) Because I
> expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12
<FROGGS> p: say (1,2).Str
<camelia> rakudo-parrot 46234b: OUTPUT«1 2␤»

A Parcel stringifies to "1 2". Then you used the string repeatition
operator "x", and I think you want to use the list repeatition operator
"xx" instead.
<FROGGS> p: say join("|", (1,2) xx 10)
<camelia> rakudo-parrot 46234b:
OUTPUT«1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2␤»

Then again, you might want to do this instead:
<FROGGS> p: say join("|", (1,2).Str xx 10)
<camelia> rakudo-parrot 46234b: OUTPUT«1 2|1 2|1 2|1 2|1 2|1 2|1 2|1 2|1
2|1 2␤»
>
> PS. perl6 --version
> This is perl6 version 2014.01 built on parrot 5.9.0 revision 0
>
> --
> Regards
>
> Kamil Kułaga

Reply via email to