<commit_before>my class Junction { # declared in BOOTSTRAP
    # class Junction is Mu
    #     has Mu $!storage;              # elements of Junction
    #     has str $!type;                # type of Junction

    method !SET-SELF(\type,\values) {
        nqp::stmts(
          ($!type = type),
          nqp::if(
            nqp::iseq_s($!type,"any")
              || nqp::iseq_s($!type,"all")
              || nqp::iseq_s($!type,"none")
              || nqp::iseq_s($!type,"one"),
            nqp::stmts(
              ($!storage := nqp::if(
                nqp::isconcrete(
                  $_ := nqp::getattr(values.eager.list,List,'$!reified')),
                $_,
                nqp::create(IterationBuffer))),
              self
            ),
            Failure.new("Junction can only have 'any', 'all', 'none', 'one' type")
          )
        )
    }

    proto method new(|) { * }
    multi method new(Junction: \values, Str :$type!) {
        nqp::create(Junction)!SET-SELF($type,values)
    }
    multi method new(Junction: Str:D \type, \values) {
        nqp::create(Junction)!SET-SELF(type,values)
    }

    method defined(Junction:D:) {
        nqp::stmts(
          (my int $elems = nqp::elems($!storage)),
          (my int $i = 0),
          nqp::if(
            nqp::iseq_s($!type,'any'),
            nqp::stmts(
              nqp::while(
                (nqp::islt_i($i,$elems)
                  && nqp::if(nqp::atpos($!storage,$i).defined,0,1)),
                ($i = nqp::add_i($i,1))
              ),
              nqp::p6bool(nqp::islt_i($i,$elems))
            ),
            nqp::if(
              nqp::iseq_s($!type,'all'),
              nqp::stmts(
                nqp::while(
                  (nqp::islt_i($i,$elems)
                    && nqp::atpos($!storage,$i).defined),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::p6bool(nqp::iseq_i($i,$elems))
              ),
              nqp::if(
                nqp::iseq_s($!type,'none'),
                nqp::stmts(
                  nqp::while(
                    (nqp::islt_i($i,$elems)
                      && nqp::if(nqp::atpos($!storage,$i).defined,0,1)),
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::p6bool(nqp::iseq_i($i,$elems))
                ),
                nqp::stmts(    # $!type eq 'one'
                  (my int $seen = 0),
                  ($i = nqp::sub_i($i,1)),  # increment in condition
                  nqp::while(
                    (nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                      && nqp::isle_i($seen,1)),
                    nqp::if(
                      nqp::atpos($!storage,$i).defined,
                      ($seen = nqp::add_i($seen,1))
                    )
                  ),
                  nqp::p6bool(nqp::iseq_i($seen,1))
                )
              )
            )
          )
        )
    }

    multi method Bool(Junction:D:) {
        nqp::stmts(
          (my int $elems = nqp::elems($!storage)),
          (my int $i = 0),
          nqp::if(
            nqp::iseq_s($!type,'any'),
            nqp::stmts(
              nqp::while(
                (nqp::islt_i($i,$elems)
                  && nqp::if(nqp::atpos($!storage,$i),0,1)),
                ($i = nqp::add_i($i,1))
              ),
              nqp::p6bool(nqp::islt_i($i,$elems))
            ),
            nqp::if(
              nqp::iseq_s($!type,'all'),
              nqp::stmts(
                nqp::while(
                  (nqp::islt_i($i,$elems)
                    && nqp::atpos($!storage,$i)),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::p6bool(nqp::iseq_i($i,$elems))
              ),
              nqp::if(
                nqp::iseq_s($!type,'none'),
                nqp::stmts(
                  nqp::while(
                    (nqp::islt_i($i,$elems)
                      && nqp::if(nqp::atpos($!storage,$i),0,1)),
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::p6bool(nqp::iseq_i($i,$elems))
                ),
                nqp::stmts(    # $!type eq 'one'
                  (my int $seen = 0),
                  ($i = nqp::sub_i($i,1)),  # increment in condition
                  nqp::while(
                    (nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                      && nqp::isle_i($seen,1)),
                    nqp::if(
                      nqp::atpos($!storage,$i),
                      ($seen = nqp::add_i($seen,1))
                    )
                  ),
                  nqp::p6bool(nqp::iseq_i($seen,1))
                )
              )
            )
          )
        )
    }

    multi method ACCEPTS(Junction:U: Mu:D \topic) {
        nqp::p6bool(nqp::istype(topic, Junction));
    }
    multi method ACCEPTS(Junction:U: Any \topic) {
        nqp::p6bool(nqp::istype(topic, Junction));
    }
    multi method ACCEPTS(Junction:D: Mu \topic) {
        nqp::stmts(
          (my int $elems = nqp::elems($!storage)),
          (my int $i = 0),
          nqp::if(
            nqp::iseq_s($!type,'any'),
            nqp::stmts(
              nqp::while(
                (nqp::islt_i($i,$elems)
                  && nqp::if(nqp::atpos($!storage,$i).ACCEPTS(topic),0,1)),
                ($i = nqp::add_i($i,1))
              ),
              nqp::p6bool(nqp::islt_i($i,$elems))
            ),
            nqp::if(
              nqp::iseq_s($!type,'all'),
              nqp::stmts(
                nqp::while(
                  (nqp::islt_i($i,$elems)
                    && nqp::atpos($!storage,$i).ACCEPTS(topic)),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::p6bool(nqp::iseq_i($i,$elems))
              ),
              nqp::if(
                nqp::iseq_s($!type,'none'),
                nqp::stmts(
                  nqp::while(
                    (nqp::islt_i($i,$elems)
                      && nqp::if(nqp::atpos($!storage,$i).ACCEPTS(topic),0,1)),
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::p6bool(nqp::iseq_i($i,$elems))
                ),
                nqp::stmts(    # $!type eq 'one'
                  (my int $seen = 0),
                  ($i = nqp::sub_i($i,1)),  # increment in condition
                  nqp::while(
                    (nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                      && nqp::isle_i($seen,1)),
                    nqp::if(
                      nqp::atpos($!storage,$i).ACCEPTS(topic),
                      ($seen = nqp::add_i($seen,1))
                    )
                  ),
                  nqp::p6bool(nqp::iseq_i($seen,1))
                )
              )
            )
          )
        )
    }

    multi method Str(Junction:D:) {
        self.perl
    }<commit_msg>Streamline Junction.defined|Bool|ACCEPTS<commit_after>my class Junction { # declared in BOOTSTRAP
    # class Junction is Mu
    #     has Mu $!storage;              # elements of Junction
    #     has str $!type;                # type of Junction

    method !SET-SELF(\type,\values) {
        nqp::stmts(
          ($!type = type),
          nqp::if(
            nqp::iseq_s($!type,"any")
              || nqp::iseq_s($!type,"all")
              || nqp::iseq_s($!type,"none")
              || nqp::iseq_s($!type,"one"),
            nqp::stmts(
              ($!storage := nqp::if(
                nqp::isconcrete(
                  $_ := nqp::getattr(values.eager.list,List,'$!reified')),
                $_,
                nqp::create(IterationBuffer))),
              self
            ),
            Failure.new("Junction can only have 'any', 'all', 'none', 'one' type")
          )
        )
    }

    proto method new(|) { * }
    multi method new(Junction: \values, Str :$type!) {
        nqp::create(Junction)!SET-SELF($type,values)
    }
    multi method new(Junction: Str:D \type, \values) {
        nqp::create(Junction)!SET-SELF(type,values)
    }

    method defined(Junction:D:) {
        nqp::p6bool(
          nqp::stmts(
            (my int $elems = nqp::elems($!storage)),
            (my int $i),
            nqp::if(
              nqp::iseq_s($!type,'any'),
              nqp::stmts(
                nqp::while(
                  nqp::islt_i($i,$elems)
                    && nqp::isfalse(nqp::atpos($!storage,$i).defined),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::islt_i($i,$elems)
              ),
              nqp::if(
                nqp::iseq_s($!type,'all'),
                nqp::stmts(
                  nqp::while(
                    nqp::islt_i($i,$elems)
                      && nqp::atpos($!storage,$i).defined,
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::iseq_i($i,$elems)
                ),
                nqp::if(
                  nqp::iseq_s($!type,'none'),
                  nqp::stmts(
                    nqp::while(
                      nqp::islt_i($i,$elems)
                        && nqp::isfalse(nqp::atpos($!storage,$i).defined),
                      ($i = nqp::add_i($i,1))
                    ),
                    nqp::iseq_i($i,$elems)
                  ),
                  nqp::stmts(    # $!type eq 'one'
                    (my int $seen = 0),
                    ($i = nqp::sub_i($i,1)),  # increment in condition
                    nqp::while(
                      nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                        && nqp::isle_i($seen,1),
                      nqp::if(
                        nqp::atpos($!storage,$i).defined,
                        ($seen = nqp::add_i($seen,1))
                      )
                    ),
                    nqp::iseq_i($seen,1)
                  )
                )
              )
            )
          )
        )
    }

    multi method Bool(Junction:D:) {
        nqp::p6bool(
          nqp::stmts(
            (my int $elems = nqp::elems($!storage)),
            (my int $i),
            nqp::if(
              nqp::iseq_s($!type,'any'),
              nqp::stmts(
                nqp::while(
                  nqp::islt_i($i,$elems)
                    && nqp::isfalse(nqp::atpos($!storage,$i)),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::islt_i($i,$elems)
              ),
              nqp::if(
                nqp::iseq_s($!type,'all'),
                nqp::stmts(
                  nqp::while(
                    nqp::islt_i($i,$elems)
                      && nqp::atpos($!storage,$i),
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::iseq_i($i,$elems)
                ),
                nqp::if(
                  nqp::iseq_s($!type,'none'),
                  nqp::stmts(
                    nqp::while(
                      nqp::islt_i($i,$elems)
                        && nqp::isfalse(nqp::atpos($!storage,$i)),
                      ($i = nqp::add_i($i,1))
                    ),
                    nqp::iseq_i($i,$elems)
                  ),
                  nqp::stmts(    # $!type eq 'one'
                    (my int $seen = 0),
                    ($i = nqp::sub_i($i,1)),  # increment in condition
                    nqp::while(
                      nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                        && nqp::isle_i($seen,1),
                      nqp::if(
                        nqp::atpos($!storage,$i),
                        ($seen = nqp::add_i($seen,1))
                      )
                    ),
                    nqp::iseq_i($seen,1)
                  )
                )
              )
            )
          )
        )
    }

    multi method ACCEPTS(Junction:U: Mu:D \topic) {
        nqp::p6bool(nqp::istype(topic, Junction));
    }
    multi method ACCEPTS(Junction:U: Any \topic) {
        nqp::p6bool(nqp::istype(topic, Junction));
    }
    multi method ACCEPTS(Junction:D: Mu \topic) {
        nqp::p6bool(
          nqp::stmts(
            (my int $elems = nqp::elems($!storage)),
            (my int $i),
            nqp::if(
              nqp::iseq_s($!type,'any'),
              nqp::stmts(
                nqp::while(
                  nqp::islt_i($i,$elems)
                    && nqp::isfalse(nqp::atpos($!storage,$i).ACCEPTS(topic)),
                  ($i = nqp::add_i($i,1))
                ),
                nqp::islt_i($i,$elems)
              ),
              nqp::if(
                nqp::iseq_s($!type,'all'),
                nqp::stmts(
                  nqp::while(
                    nqp::islt_i($i,$elems)
                      && nqp::atpos($!storage,$i).ACCEPTS(topic),
                    ($i = nqp::add_i($i,1))
                  ),
                  nqp::iseq_i($i,$elems)
                ),
                nqp::if(
                  nqp::iseq_s($!type,'none'),
                  nqp::stmts(
                    nqp::while(
                      nqp::islt_i($i,$elems)
                        && nqp::isfalse(
                             nqp::atpos($!storage,$i).ACCEPTS(topic)
                           ),
                      ($i = nqp::add_i($i,1))
                    ),
                    nqp::iseq_i($i,$elems)
                  ),
                  nqp::stmts(    # $!type eq 'one'
                    (my int $seen),
                    ($i = nqp::sub_i($i,1)),  # increment in condition
                    nqp::while(
                      nqp::islt_i(($i = nqp::add_i($i,1)),$elems)
                        && nqp::isle_i($seen,1),
                      nqp::if(
                        nqp::atpos($!storage,$i).ACCEPTS(topic),
                        ($seen = nqp::add_i($seen,1))
                      )
                    ),
                    nqp::iseq_i($seen,1)
                  )
                )
              )
            )
          )
        )
    }

    multi method Str(Junction:D:) {
        self.perl
    }
{'fraction_non_alphanumeric': 0.16867038786317445, 'fraction_numerical': 0.00622584800343495, 'mean_word_length': 1.0494207361783252, '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': '769612', 'n_tokens_mistral': 4693, 'n_tokens_neox': 4441, 'n_words': 535}