<commit_before>my class Mu {
    method new() {
        self.bless(self.CREATE());
    }
    
    proto method ACCEPTS(|$) { * }
    multi method ACCEPTS(Mu:U: \$topic) {
        pir::perl6_booleanize__PI(pir::type_check__IPP($topic, self))
    }

    method WHERE() {
        pir::perl6_box_int__PI(pir::get_addr__IP(self))
    }
    
    method Bool() {
        self.defined
    }
    
    method defined() {
        pir::perl6_booleanize__PI(pir::repr_defined__IP(self))
    }
    
    method CREATE() {
        pir::repr_instance_of__PP(self.WHAT)
    }
    
    method bless(Mu \$candidate) {
        $candidate
    }
    
    proto method Str(|$) { * }
    multi method Str(Mu:U:) {
        self.HOW.name(self) ~ '()'
    }
    multi method Str(Mu:D:) {
        self.HOW.name(self) ~ '<' ~ self.WHERE ~ '>'
    }

    proto method Stringy(|$) { * }
    multi method Stringy(Mu:U:) {
        ''   # TODO: should be a warning of some sort
    }
    multi method Stringy(Mu:D:) { self.Str }
    
    method item() { self }
    
    method say() { say(self) }

    proto method perl(|$) { * }
    multi method perl(Mu:D:) { self.Str }
    multi method perl(Mu:U:) { self.HOW.name(self) }

    proto method DUMP(|$) { * }
    multi method DUMP(Mu:D:) { self.perl }
    multi method DUMP(Mu:U:) { self.perl }
    method DUMP-ID() { self.HOW.name(self) ~ '<' ~ self.WHERE ~ '>' }
    
}


sub DUMP(|$) {
    my Mu $args := pir::perl6_current_args_rpa__P();
    my Mu $topic  := pir::shift__PP($args);
    if pir::isa__IPs($topic, 'ResizablePMCArray') {
        my $s = 'RPA<' ~ pir::perl6_box_str__Ps(pir::get_addr__IP($topic)) ~ '>(';
        my $t = '';
        $topic := pir::clone__PP($topic);
        while $topic {
            my Mu $x := pir::shift__PP($topic);
            $s = $s ~ $t ~ (pir::isnull__IP($x)
                            ?? '(null)'
                            !! $x.DUMP());
            $t = ', ';
        }
        $s ~ ')'
    }
    else { $topic.DUMP() }
};
<commit_msg>Add container markers to DUMP output.<commit_after>my class Mu {
    method new() {
        self.bless(self.CREATE());
    }
    
    proto method ACCEPTS(|$) { * }
    multi method ACCEPTS(Mu:U: \$topic) {
        pir::perl6_booleanize__PI(pir::type_check__IPP($topic, self))
    }

    method WHERE() {
        pir::perl6_box_int__PI(pir::get_addr__IP(self))
    }
    
    method Bool() {
        self.defined
    }
    
    method defined() {
        pir::perl6_booleanize__PI(pir::repr_defined__IP(self))
    }
    
    method CREATE() {
        pir::repr_instance_of__PP(self.WHAT)
    }
    
    method bless(Mu \$candidate) {
        $candidate
    }
    
    proto method Str(|$) { * }
    multi method Str(Mu:U:) {
        self.HOW.name(self) ~ '()'
    }
    multi method Str(Mu:D:) {
        self.HOW.name(self) ~ '<' ~ self.WHERE ~ '>'
    }

    proto method Stringy(|$) { * }
    multi method Stringy(Mu:U:) {
        ''   # TODO: should be a warning of some sort
    }
    multi method Stringy(Mu:D:) { self.Str }
    
    method item() { self }
    
    method say() { say(self) }

    proto method perl(|$) { * }
    multi method perl(Mu:D:) { self.Str }
    multi method perl(Mu:U:) { self.HOW.name(self) }

    proto method DUMP(|$) { * }
    multi method DUMP(Mu:D:) { self.perl }
    multi method DUMP(Mu:U:) { self.perl }
    method DUMP-ID() { self.HOW.name(self) ~ '<' ~ self.WHERE ~ '>' }
    
}


sub DUMP(|$) {
    my Mu $args := pir::perl6_current_args_rpa__P();
    my Mu $topic  := pir::shift__PP($args);
    if pir::isa__IPs($topic, 'ResizablePMCArray') {
        my $s = 'RPA<' ~ pir::perl6_box_str__Ps(pir::get_addr__IP($topic)) ~ '>(';
        my $t = '';
        $topic := pir::clone__PP($topic);
        while $topic {
            my Mu $x := pir::shift__PP($topic);
            $s = $s ~ $t ~ (pir::isnull__IP($x)
                            ?? '(null)'
                            !! DUMP($x));
            $t = ', ';
        }
        $s ~ ')'
    }
    else { 
        pir::is_container__IP($topic)
          ?? '▶' ~ $topic.DUMP() 
          !! $topic.DUMP()
    }
};

{'fraction_non_alphanumeric': 0.1745799853907962, 'fraction_numerical': 0.0024348672997321647, 'mean_word_length': 1.9448028673835125, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3547522', 'n_tokens_mistral': 1545, 'n_tokens_neox': 1472, 'n_words': 268}