<commit_before>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "rdb_protocol/terms/terms.hpp"

#include <string>

#include "rdb_protocol/error.hpp"
#include "rdb_protocol/func.hpp"
#include "rdb_protocol/op.hpp"
#include "rdb_protocol/pathspec.hpp"
#include "rdb_protocol/pb_utils.hpp"
#include "rdb_protocol/pseudo_literal.hpp"

#pragma GCC diagnostic ignored "-Wshadow"

namespace ql {

// This term is used for functions that are polymorphic on objects and
// sequences, like `pluck`.  It will handle the polymorphism; terms inheriting
// from it just need to implement evaluation on objects (`obj_eval`).
class obj_or_seq_op_term_t : public op_term_t {
public:
    enum poly_type_t {
        MAP = 0,
        FILTER = 1,
        SKIP_MAP = 2
    };
    obj_or_seq_op_term_t(compile_env_t *env, protob_t<const Term> term,
                         poly_type_t _poly_type, argspec_t argspec)
        : op_term_t(env, term, argspec, optargspec_t({"_NO_RECURSE_"})),
          poly_type(_poly_type), func(make_counted_term()) {
        const sym_t varnum = env->symgen->gensym();
        Term *arg = pb::set_func(func.get(), varnum);
        Term *body = NULL;
        switch (poly_type) {
        case MAP: {
            body = arg;
            *arg = *term;
            Term_AssocPair *ap = arg->add_optargs();
            ap->set_key("_NO_RECURSE_");
            arg = ap->mutable_val();
            NDATUM_BOOL(true);
        } break;
        case FILTER: {
            body = arg;
            *arg = *term;
            Term_AssocPair *ap = arg->add_optargs();<commit_msg>Made obj_or_seq_op_term_t use hard-coded gensym.<commit_after>// Copyright 2010-2013 RethinkDB, all rights reserved.
#include "rdb_protocol/terms/terms.hpp"

#include <string>

#include "rdb_protocol/error.hpp"
#include "rdb_protocol/func.hpp"
#include "rdb_protocol/op.hpp"
#include "rdb_protocol/pathspec.hpp"
#include "rdb_protocol/pb_utils.hpp"
#include "rdb_protocol/pseudo_literal.hpp"

#pragma GCC diagnostic ignored "-Wshadow"

namespace ql {

// This term is used for functions that are polymorphic on objects and
// sequences, like `pluck`.  It will handle the polymorphism; terms inheriting
// from it just need to implement evaluation on objects (`obj_eval`).
class obj_or_seq_op_term_t : public op_term_t {
public:
    enum poly_type_t {
        MAP = 0,
        FILTER = 1,
        SKIP_MAP = 2
    };
    obj_or_seq_op_term_t(compile_env_t *env, protob_t<const Term> term,
                         poly_type_t _poly_type, argspec_t argspec)
        : op_term_t(env, term, argspec, optargspec_t({"_NO_RECURSE_"})),
          poly_type(_poly_type), func(make_counted_term()) {
        const sym_t varnum = GENSYM_A();
        Term *arg = pb::set_func(func.get(), varnum);
        Term *body = NULL;
        switch (poly_type) {
        case MAP: {
            body = arg;
            *arg = *term;
            Term_AssocPair *ap = arg->add_optargs();
            ap->set_key("_NO_RECURSE_");
            arg = ap->mutable_val();
            NDATUM_BOOL(true);
        } break;
        case FILTER: {
            body = arg;
            *arg = *term;
            Term_AssocPair *ap = arg->add_optargs();
{'fraction_non_alphanumeric': 0.11228945726762321, 'fraction_numerical': 0.006862133499688085, 'mean_word_length': 2.6567844925883692, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 17, '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': '4024661', 'n_tokens_mistral': 1123, 'n_tokens_neox': 1068, 'n_words': 255}