<commit_before>my class MixHash does Mixy {

    method at_key($k) {
        Proxy.new(
          FETCH => {
              my $key   := $k.WHICH;
              %!elems.exists_key($key) ?? %!elems{$key}.value !! 0;
          },
          STORE => -> $, $value {
              if $value != 0 {
                  (%!elems{$k.WHICH} //= ($k => 0)).value = $value;
              }
              else {
                  self.delete_key($k);
              }
              $value;
          }
        );
    }

    method delete($k) {  # is DEPRECATED doesn't work in settings
        DEPRECATED("the :delete adverb with postcircumfix:<{ }>");
        self.delete_key($k);
    }
    method delete_key($k) {
        my $key   := $k.WHICH;
        if %!elems.exists_key($key) {
            my $value = %!elems{$key}.value;
            %!elems.delete_key($key);
            $value;
        }
        else {
            0;
        }
    }

    method Mix (:$view) {
        if $view {
            my $mix := nqp::create(Mix);
            $mix.BUILD( :elems(%!elems) );
            $mix;
        }
        else {
            Mix.new-fp(%!elems.values);
        }
    }           
    method MixHash { self }
    method Bag     { Bag.new-fp(%!elems.values) }
    method BagHash { BagHash.new-fp(%!elems.values) }
}

# vim: ft=perl6 expandtab sw=4
<commit_msg>forgot to :w a file<commit_after>my class MixHash does Mixy {

    method at_key($k) {
        Proxy.new(
          FETCH => {
              my $key   := $k.WHICH;
              %!elems.exists_key($key) ?? %!elems{$key}.value !! 0;
          },
          STORE => -> $, $value {
              if $value != 0 {
                  (%!elems{$k.WHICH} //= ($k => 0)).value = $value;
              }
              else {
                  self.delete_key($k);
              }
              $value;
          }
        );
    }

    method delete($k) {  # is DEPRECATED doesn't work in settings
        DEPRECATED('the :delete adverb with postcircumfix:<{ }>');
        self.delete_key($k);
    }
    method delete_key($k) {
        my $key   := $k.WHICH;
        if %!elems.exists_key($key) {
            my $value = %!elems{$key}.value;
            %!elems.delete_key($key);
            $value;
        }
        else {
            0;
        }
    }

    method Mix (:$view) {
        if $view {
            my $mix := nqp::create(Mix);
            $mix.BUILD( :elems(%!elems) );
            $mix;
        }
        else {
            Mix.new-fp(%!elems.values);
        }
    }           
    method MixHash { self }
    method Bag     { Bag.new-fp(%!elems.values) }
    method BagHash { BagHash.new-fp(%!elems.values) }
}

# vim: ft=perl6 expandtab sw=4

{'fraction_non_alphanumeric': 0.15678280207561157, 'fraction_numerical': 0.004447739065974796, 'mean_word_length': 1.2435577722360764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '5481918', 'n_tokens_mistral': 923, 'n_tokens_neox': 886, 'n_words': 166}