Revision 26129

Date:
2009/04/08 16:29:54
Author:
lwall
Revision Log:
[S32/Containers] join defaults to '' now; delete string reverse
[S32/Str] add string flip
Files:

Legend:

 
Added
 
Removed
 
Modified
  • docs/Perl6/Spec/S32-setting-library/Containers.pod

     
    214 214
    215 215 =item join
    216 216
    217 our Str multi method join ( @values: Str $separator = ' ' )
    218 our Str multi join ( Str $separator = ' ', *@values )
    217 our Str multi method join ( @values: Str $separator = '' )
    218 our Str multi join ( Str $separator = '', *@values )
    219 219
    220 220 C<join> returns a single string comprised of all of the elements
    221 221 of C<@values>, separated by C<$separator>.
    222 222
    223 223 Given an empty list, C<join> returns the empty string.
    224 224
    225 The separator defaults to a single space. To join with no separator,
    226 you can use the C<[~]> reduce operator. The C<cat> function also
    227 effectively does a concatenation with no separator.
    225 The separator defaults to the null string. To join with space,
    226 just coerce to C<Str>.
    228 227
    229 228 =item map
    230 229
     
    282 281 }
    283 282 }
    284 283
    285 role Str {
    286 our Str multi method reverse ( $str: ) is export {
    287 $str.split('').reverse.join;
    288 }
    289 }
    290
    291 284 =item sort
    292 285
    293 286 our Array multi method sort( @values: *&by )
  • docs/Perl6/Spec/S32-setting-library/Str.pod

     
    372 372 are never returned. If the function is combing a lazy structure,
    373 373 the return values may also be lazy. (Strings are not lazy, however.)
    374 374
    375 =item flip
    376
    377 The C<flip> function reverses a string character by character.
    378
    379 our Str multi method flip ( $str: ) is export {
    380 $str.comb(/./).reverse.join;
    381 }
    382
    383 This function will misplace accents if used at a Unicode
    384 level less than graphemes.
    385
    375 386 =item sprintf
    376 387
    377 388 our Str multi method sprintf ( Str $format: *@args ) is export