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
This is perl6 version 2014.01 built on parrot 5.9.0 revision 0

--
Regards

Kamil Kułaga


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 teodoz...@gmail.com wrote:

 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
 This is perl6 version 2014.01 built on parrot 5.9.0 revision 0
 
 --
 Regards
 
 Kamil Kułaga
 



smime.p7s
Description: S/MIME cryptographic signature


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 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



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 em...@froggs.de wrote:
 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




-- 
Pozdrawiam

Kamil Kułaga


Re: Unusual use of x string repetition operator

2014-02-10 Thread Tobias Leich
Hi, what about this?

FROGGS r: say ((1,2).join xx 10).join('|')
camelia 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 around.

 Thanks for fast reply

 On Mon, Feb 10, 2014 at 2:29 PM, Tobias Leich em...@froggs.de wrote:
 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





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 em...@froggs.de wrote:
 Hi, what about this?

 FROGGS r: say ((1,2).join xx 10).join('|')
 camelia 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 around.

 Thanks for fast reply

 On Mon, Feb 10, 2014 at 2:29 PM, Tobias Leich em...@froggs.de wrote:
 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






-- 
Pozdrawiam

Kamil Kułaga


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 is perl6 version 2014.01 built on parrot 5.9.0 revision 0

-- 
Regards

Kamil Kułaga