<commit_before>my class MapIter { ... }
my class Range { ... }
my class X::Bind::Slice { ... }
my class X::Bind::ZenSlice { ... }
my $default= [];  # so that we can check passing of parameters to ".hash"

my class Any {
    multi method ACCEPTS(Any:D: Mu \a) { self === a }

    ########
    # List-like methods for Any.
    ########

    method eager() { nqp::p6list(nqp::list(self), List, Bool::True).eager }
    method elems() { self.list.elems }
    method end()   { self.list.end }
    method classify(&t) { self.list.classify(&t) }
    method uniq() { self.list.uniq }
    method infinite() { Mu }
    method flat() { nqp::p6list(nqp::list(self), List, Bool::True) }
    method hash( :$type = $default, :$of = $default ) {

        # your basic hash
        if ( $type === $default and $of === $default ) {
            my %h = self;
        }

        # need to add type / of info
        else {
            my $code= $of === $default ?? "my %h" !! "my {$of.perl} %h";
            $code ~= "\{{$type.perl}}" unless $type === $default;
            $code ~= " = self";
            eval $code;<commit_msg>Get rid of evil eval hack in Any.hash, change type to keytype<commit_after>my class MapIter { ... }
my class Range { ... }
my class X::Bind::Slice { ... }
my class X::Bind::ZenSlice { ... }
my $default= [];  # so that we can check passing of parameters to ".hash"

my class Any {
    multi method ACCEPTS(Any:D: Mu \a) { self === a }

    ########
    # List-like methods for Any.
    ########

    method eager() { nqp::p6list(nqp::list(self), List, Bool::True).eager }
    method elems() { self.list.elems }
    method end()   { self.list.end }
    method classify(&t) { self.list.classify(&t) }
    method uniq() { self.list.uniq }
    method infinite() { Mu }
    method flat() { nqp::p6list(nqp::list(self), List, Bool::True) }
    method hash( :$keytype = $default, :$of = $default ) {

        # your basic hash
        if ( $keytype === $default and $of === $default ) {
            my % = self;
        }

        # need to add type / of info
        else {
            Hash[
              $of      === $default ?? Any !!
                  ( $of.DEFINITE      ?? ::($of)      !! $of ),
              $keytype === $default ?? Str !!
                  ( $keytype.DEFINITE ?? ::($keytype) !! $keytype ),
            ].new(self);
{'fraction_non_alphanumeric': 0.1883005977796755, 'fraction_numerical': 0.0017079419299743809, 'mean_word_length': 2.058746736292428, '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': '7412592', 'n_tokens_mistral': 780, 'n_tokens_neox': 754, 'n_words': 217}