<commit_before>// abc.js
// https://github.com/marpple/abc-functional-javascript
// (c) 2016 Marpple
// abcjs may be freely distributed under the MIT license.

!function(G) {
    var _ = respect_underscore({}), window = typeof window != 'object' ? G : window;
    _.isEqual = _.isEqual || function(a, b) { return a===b; };

    F.A = window.A = A; // thisless apply
    F.B = window.B = B; // thisless bind, like underscore partial
    F.C = window.C = C; // thisless call
    F.D = window.D = D; // Data
    F.E = window.E = _.extend;
    F.F = window.F = F; // find function
    F.H = window.H = H; // HTML Template Engine
    F.G = window.G = G; // window or global
    F.I = window.I = I; // _.identity
    F.J = window.J = J; // _.always
    F.M = window.M = M; // for method
    F.N = window.N; // _.always(null),
    F.P = window.P = P; // parameters, arguments
    F.R = window.R = R; // like multiple return in Go Lang. return x, y; => return R(x, y)
    F.S = window.S = S; // String Template Engine
    F.TODO = window.TODO;
    F.U = window.U = U; // _.noop, return undefined
    F.V = window.V = V; // get value with string
    F.X = window.X = new Object();

    function has_Promise() { return has_Promise.__cache || (has_Promise.__cache = !!V(window, 'Promise.prototype.then')); }

    P.trim = function(args) { return args.length == 1 && args[0] === undefined ? [] : args; };
    B.P = B(I, base_bp), F.P0 = window.P0 = I, F.P1 = window.P1 = B.P(1),
    F.P2 = window.P2 = B.P(2), F.P3 = window.P3 = B.P(3), F.P4 = window.P4 = B.P(4);

    function A(args, func) { return C.apply(arguments[2] || this, _.toArray(args).concat([func])); }

    function B() {
        var args = _.toArray(arguments);
        if (!_.isArray(args[args.length-1])) args[args.length-1] = [args[args.length-1]];
        var fns = args.pop();
        return function() {
            var args3 = _.clone(args);
            for (var i = 0, length = arguments.length; i < length; i++) {
                var arg2 = arguments[i];
                var idx = args3.indexOf(X);
                args3[idx == -1 ? args3.length : idx] = arg2;
            }
            return A(args3, fns, this);
        };
    }

    function base_bp(next, idx) {
        if (arguments.length == 2) return function () { return arguments[idx] };
        var idxs = _.rest(arguments);
        return function() {
            return next(C.map(idxs, arguments, function(v, i, l, args) { return args[v]; }));
        };
    }

    B.PR = B(TO_R, base_bp);

    B.V = function(key) { return B(X, key, V); };

    B.M = function() { return B.apply(void 0, [X].concat(_.toArray(arguments)).concat(M)); };

    B.map = function(iter) {
        return B(
            function(result, list, keys, i, res) {  // body
                if (i) result.push(res);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,       // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    var arg_add_arr = function(list) { return R(list, []); };
    var all_map = B.map(function(val_fn, key, list, args) { return A(args, val_fn, this); });
    var div_map = B.map(function(val, key, list, funcs) { return A([val], funcs[key] || I, this); });

    B.all = function() {
        var fns = _.toArray(arguments);
        return function() {
            return A([fns, _.toArray(arguments)], [all_map, arg_add_arr, spread_args, TO_R], this);
        };
    };

    B.div = function() {
        var fns = _.toArray(arguments);
        return function() {
            var args = _.toArray(arguments);
            while(args.length < fns.length) args.push(void 0);
            return A([args, fns], [div_map, arg_add_arr, spread_args, TO_R], this);
        };
    };

    var c_if = IF(function() { return arguments.length == 3 }, R).ELSE(B.all(_.rest, B.V('0'), P1));
    var b_if = IF(function() { return arguments.length > 1 }, R).ELSE(B.all(_.rest, B.V('0')));
    B.reduce = function(iter) {
        return B([iter == null ? c_if : b_if,
                B(function(result, list, keys, i, res, tmp, args) {     // body
                    return i == 0 ? args[0] : res;
                },
                U, // end_q
                void 0, // end
                P2, // complete
                iter,   // iter_or_predi
                function(list, keys, i, res) { // params
                    var key = keys ? keys[i] : i;
                    return [res, list[key], key, list];
                },
                    base_loop_fn)]);
    };

    var spread_args = B.reduce(function(memo, arg) { return memo.concat(IS_R(arg) ? arg : [arg]); });

    B.each = function(iter) {
        return B(
            P4, // body
            U, // end_q
            void 0, // end
            P1,
            iter, // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.filter = function(iter) {
        return B(
            function(result, list, keys, i, res) {  // body
                var key = keys ? keys[i-1] : i-1;
                if (res) result.push(list[key]);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,   // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.reject = function(iter) {
        return B(
            function(result, list, keys, i, res) {   // body
                var key = keys ? keys[i-1] : i-1;
                if (res == false) result.push(list[key]);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.find = function(iter) {
        return B(
            P4,
            I, // end_q
            function(list, keys, i) {
                return list[keys ? keys[i-1] : i-1];
            }, // end
            U, // complete
            iter,   // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.find_i = B.find_index = function(iter) {
        return B(
            P4, // body
            I, // end_q
            function(list, keys, i) {
                return keys ? keys[i-1] : i-1;
            }, // end
            J(-1), // complete
            iter,
            base_loop_fn_base_args,
            base_loop_fn
        )
    };

    B.some = function(iter) {
        return B(
            P4,
            I, // end_q
            J(true), // end
            J(false), // complete
            iter,
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.every = function(iter) {
        return B(
            function(result, list, keys, i, res) { return i == 0 ? true : res; },   // body<commit_msg>B.find_i (=B.find_index) 추가 C.find_i (=C.find_index) 추가<commit_after>// abc.js
// https://github.com/marpple/abc-functional-javascript
// (c) 2016 Marpple
// abcjs may be freely distributed under the MIT license.

!function(G) {
    var _ = respect_underscore({}), window = typeof window != 'object' ? G : window;
    _.isEqual = _.isEqual || function(a, b) { return a===b; };

    F.A = window.A = A; // thisless apply
    F.B = window.B = B; // thisless bind, like underscore partial
    F.C = window.C = C; // thisless call
    F.D = window.D = D; // Data
    F.E = window.E = _.extend;
    F.F = window.F = F; // find function
    F.H = window.H = H; // HTML Template Engine
    F.G = window.G = G; // window or global
    F.I = window.I = I; // _.identity
    F.J = window.J = J; // _.always
    F.M = window.M = M; // for method
    F.N = window.N; // _.always(null),
    F.P = window.P = P; // parameters, arguments
    F.R = window.R = R; // like multiple return in Go Lang. return x, y; => return R(x, y)
    F.S = window.S = S; // String Template Engine
    F.TODO = window.TODO;
    F.U = window.U = U; // _.noop, return undefined
    F.V = window.V = V; // get value with string
    F.X = window.X = new Object();

    function has_Promise() { return has_Promise.__cache || (has_Promise.__cache = !!V(window, 'Promise.prototype.then')); }

    P.trim = function(args) { return args.length == 1 && args[0] === undefined ? [] : args; };
    B.P = B(I, base_bp), F.P0 = window.P0 = I, F.P1 = window.P1 = B.P(1),
    F.P2 = window.P2 = B.P(2), F.P3 = window.P3 = B.P(3), F.P4 = window.P4 = B.P(4);

    function A(args, func) { return C.apply(arguments[2] || this, _.toArray(args).concat([func])); }

    function B() {
        var args = _.toArray(arguments);
        if (!_.isArray(args[args.length-1])) args[args.length-1] = [args[args.length-1]];
        var fns = args.pop();
        return function() {
            var args3 = _.clone(args);
            for (var i = 0, length = arguments.length; i < length; i++) {
                var arg2 = arguments[i];
                var idx = args3.indexOf(X);
                args3[idx == -1 ? args3.length : idx] = arg2;
            }
            return A(args3, fns, this);
        };
    }

    function base_bp(next, idx) {
        if (arguments.length == 2) return function () { return arguments[idx] };
        var idxs = _.rest(arguments);
        return function() {
            return next(C.map(idxs, arguments, function(v, i, l, args) { return args[v]; }));
        };
    }

    B.PR = B(TO_R, base_bp);

    B.V = function(key) { return B(X, key, V); };

    B.M = function() { return B.apply(void 0, [X].concat(_.toArray(arguments)).concat(M)); };

    B.map = function(iter) {
        return B(
            function(result, list, keys, i, res) {  // body
                if (i) result.push(res);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,       // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    var arg_add_arr = function(list) { return R(list, []); };
    var all_map = B.map(function(val_fn, key, list, args) { return A(args, val_fn, this); });
    var div_map = B.map(function(val, key, list, funcs) { return A([val], funcs[key] || I, this); });

    B.all = function() {
        var fns = _.toArray(arguments);
        return function() {
            return A([fns, _.toArray(arguments)], [all_map, arg_add_arr, spread_args, TO_R], this);
        };
    };

    B.div = function() {
        var fns = _.toArray(arguments);
        return function() {
            var args = _.toArray(arguments);
            while(args.length < fns.length) args.push(void 0);
            return A([args, fns], [div_map, arg_add_arr, spread_args, TO_R], this);
        };
    };

    var c_if = IF(function() { return arguments.length == 3 }, R).ELSE(B.all(_.rest, B.V('0'), P1));
    var b_if = IF(function() { return arguments.length > 1 }, R).ELSE(B.all(_.rest, B.V('0')));
    B.reduce = function(iter) {
        return B([iter == null ? c_if : b_if,
                B(function(result, list, keys, i, res, tmp, args) {     // body
                    return i == 0 ? args[0] : res;
                },
                U, // end_q
                void 0, // end
                P2, // complete
                iter,   // iter_or_predi
                function(list, keys, i, res) { // params
                    var key = keys ? keys[i] : i;
                    return [res, list[key], key, list];
                },
                    base_loop_fn)]);
    };

    var spread_args = B.reduce(function(memo, arg) { return memo.concat(IS_R(arg) ? arg : [arg]); });

    B.each = function(iter) {
        return B(
            P4, // body
            U, // end_q
            void 0, // end
            P1,
            iter, // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.filter = function(iter) {
        return B(
            function(result, list, keys, i, res) {  // body
                var key = keys ? keys[<KEY>;
                if (res) result.push(list[key]);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,   // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.reject = function(iter) {
        return B(
            function(result, list, keys, i, res) {   // body
                var key = keys ? keys[i-1] : i-1;
                if (res == false) result.push(list[key]);
                return res;
            },
            U, // end_q
            void 0, // end
            I, // complete
            iter,
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.find = function(iter) {
        return B(
            P4,
            I, // end_q
            function(list, keys, i) {
                return list[keys ? keys[i-1] : i-1];
            }, // end
            U, // complete
            iter,   // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.find_i = B.find_index = function(iter) {
        return B(
            P4, // body
            I, // end_q
            function(list, keys, i) {
                return keys ? keys[i-1] : i-1;
            }, // end
            J(-1), // complete
            iter, // iter_or_predi
            base_loop_fn_base_args,
            base_loop_fn
        )
    };

    B.some = function(iter) {
        return B(
            P4,
            I, // end_q
            J(true), // end
            J(false), // complete
            iter,
            base_loop_fn_base_args,
            base_loop_fn);
    };

    B.every = function(iter) {
        return B(
            function(result, list, keys, i, res) { return i == 0 ? true : res; },   // body
{'fraction_non_alphanumeric': 0.15214564369310793, 'fraction_numerical': 0.009102730819245773, 'mean_word_length': 1.5014456089627757, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 2, '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': '3051214', 'n_tokens_mistral': 4640, 'n_tokens_neox': 4508, 'n_words': 1128}