Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get List consisted by repeated items in Perl6?

I try to use: (^10).map({0}) to generate a list with 10 '0'. Is there another way to do it?

like image 496
Sun Wenjie Avatar asked May 17 '18 14:05

Sun Wenjie


1 Answers

0 xx 10

Generates a list of 10 integers numbered zero.

'0' xx 10

Generates a list of 10 strings consisting of the single character '0'.

See xx infix op doc.

'0' x 10

Generates a single string consisting of a sequence of 10 '0' characters.

See x infix op doc.

like image 140
raiph Avatar answered Nov 02 '22 02:11

raiph