<commit_before># http://rosettacode.org/wiki/Sierpinski_triangle#Perl_6

use v6;
use Test;

plan 1;

my $rosetta-code = {

#### RC-begin
sub sierpinski ($n) {
    my @down  = '*';
    my $space = ' ';
    for ^$n {
        @down = @down.map({"$space$_$space"}), @down.map({"$_ $_"});
        $space ~= $space;
    }
    return @down;
}
 
.say for sierpinski 4;
#### RC-end

}

my $oldOUT = $*OUT;
my $output;
$*OUT = class {
    method print(*@args) {
        $output ~= @args.join;
    }
}

$rosetta-code.();

my $expected = "               *               
              * *              
             *   *             
            * * * *            
           *       *           
          * *     * *          
         *   *   *   *         
        * * * * * * * *        <commit_msg>Explicitly flatten in Sierpinski triangle<commit_after># http://rosettacode.org/wiki/Sierpinski_triangle#Perl_6

use v6;
use Test;

plan 1;

my $rosetta-code = {

#### RC-begin
sub sierpinski ($n) {
    my @down  = '*';
    my $space = ' ';
    for ^$n {
        @down = flat @down.map({"$space$_$space"}), @down.map({"$_ $_"});
        $space ~= $space;
    }
    return @down;
}
 
.say for sierpinski 4;
#### RC-end

}

my $oldOUT = $*OUT;
my $output;
$*OUT = class {
    method print(*@args) {
        $output ~= @args.join;
    }
}

$rosetta-code.();

my $expected = "               *               
              * *              
             *   *             
            * * * *            
           *       *           
          * *     * *          
         *   *   *   *         
        * * * * * * * *        
{'fraction_non_alphanumeric': 0.17643429981492906, 'fraction_numerical': 0.004935225169648365, 'mean_word_length': 1.1398416886543536, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4102681', 'n_tokens_mistral': 594, 'n_tokens_neox': 579, 'n_words': 97}