Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi, I've played wit x and xx 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 expected? If true please explain this to me :) Because I expected 12121212121212121212 or 12|12|12|12|12|12|12|12|12|12 PS. perl6 --version This

Re: Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi, The best, because it uses object oriented join. I forgot about it. On Mon, Feb 10, 2014 at 3:23 PM, Tobias Leich wrote: > Hi, what about this? > > r: say ((1,2).join xx 10).join('|') > rakudo-parrot 46234b, rakudo-jvm 46234b, rakudo-moar 46234b: > OUTPUT«12|12|12|12|12|12|12|12|12|12␤» > >

Re: Unusual use of x string repetition operator

2014-02-10 Thread Tobias Leich
Hi, what about this? r: say ((1,2).join xx 10).join('|') rakudo-parrot 46234b, rakudo-jvm 46234b, rakudo-moar 46234b: OUTPUT«12|12|12|12|12|12|12|12|12|12␤» Am 10.02.2014 14:42, schrieb Kamil Kułaga: > Hi, > > Array stringification to "1 2" mislead me that something more > complicated comes aro

Re: Unusual use of x string repetition operator

2014-02-10 Thread Kamil Kułaga
Hi, Array stringification to "1 2" mislead me that something more complicated comes around. Thanks for fast reply On Mon, Feb 10, 2014 at 2:29 PM, Tobias Leich wrote: > Hi > Am 10.02.2014 14:19, schrieb Kamil Kułaga: >> Hi, >> >> I've played wit x and xx repetition operators and found interesti

Re: Unusual use of x string repetition operator

2014-02-10 Thread Tobias Leich
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 1212121212

Re: Unusual use of x string repetition operator

2014-02-10 Thread Pawel Pabian
x puts (1,2) array in scalar context, that's why you have "1 2" string repeated 10 times. try xx operator, it works in array context $ perl6 -e 'say join("|", (1,2) xx 10)' 1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2|1|2 bbkr On 10 Feb 2014, at 14:19, Kamil Kułaga wrote: > Hi, > > I've played wit

Unusual use of x string repetition operator

2014-02-10 Thread 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 PS. perl6 --version