<commit_before>var clone_array = require('./clone-array');



/*

Purry implementation for variable-parameter-count-functions

Currying is not supported because a target parameter count is not defined.
Partial left/between/right application is supported. Two arrays stock arguments
respective to either side. When the function is executed the stocked arguments
are merged and applied to the wrapped function. Merging entails filling left stock
holes with right stock arguments. Any remaining right-stock arguments are simply
appending to the left-stock.
*/

module.exports = function stock_vargs(f, _l_stock, _l_holey, _l_min, _r_stock, _r_holey, _r_min){
  return function(){
    var arguments_count = arguments.length;

    // Bail if no arguments given
    if (!arguments_count) {
      // console.log('Invoked without arguments, early exit');
      return f.apply(null, unify_stock(_l_holey, clone_array(_l_stock), _r_stock));
    }

    // index for various loops below
    var i;

    // console.log('\n\nInvoked: | l_stock %j | r_stock %j | new args %j', _l_stock, _r_stock, arguments)

    // Stock cloning, to avoid clobbering
    var l_stock = clone_array(_l_stock);
    var r_stock = clone_array(_r_stock);

    // State shadowing, to avoid clobbering
    var l_min = _l_min;
    var r_min = _r_min;

    // If the first argument is a pin it means there is no left shoulder
    // and it means whatever left-shoulder state we had, still is.
    var l_holey = arguments[0] === ___ ? _l_holey : false ;
    var r_holey = false;

    var is_delayed_execution = false;
    var stock = l_stock;
    var argument;
    var stock_i = l_min;
    var incby = 1;
    var endloop = arguments_count;
    // var stock_i_limit = r_min + 1;
    var stock_i_limit = stock.length;
    var hole_count = l_holey;
    var _hole_count = _l_holey;
    process_l_arguments:
    for(i = 0; i !== endloop; i += incby) {
      // console.log('\nITERATION START\nEnd when: %d !== %d | stock_i: %d', i, endloop, stock_i);
      argument = arguments[i];

      if (argument === _) {
        is_delayed_execution = true;
        // If _ is last argument it has no affect<commit_msg>Tidy i variable in stock_vargs<commit_after>var clone_array = require('./clone-array');



/*

Purry implementation for variable-parameter-count-functions

Currying is not supported because a target parameter count is not defined.
Partial left/between/right application is supported. Two arrays stock arguments
respective to either side. When the function is executed the stocked arguments
are merged and applied to the wrapped function. Merging entails filling left stock
holes with right stock arguments. Any remaining right-stock arguments are simply
appending to the left-stock.
*/

module.exports = function stock_vargs(f, _l_stock, _l_holey, _l_min, _r_stock, _r_holey, _r_min){
  return function(){
    var arguments_count = arguments.length;

    // Bail if no arguments given
    if (!arguments_count) {
      // console.log('Invoked without arguments, early exit');
      return f.apply(null, unify_stock(_l_holey, clone_array(_l_stock), _r_stock));
    }

    // console.log('\n\nInvoked: | l_stock %j | r_stock %j | new args %j', _l_stock, _r_stock, arguments)

    // Stock cloning, to avoid clobbering
    var l_stock = clone_array(_l_stock);
    var r_stock = clone_array(_r_stock);

    // State shadowing, to avoid clobbering
    var l_min = _l_min;
    var r_min = _r_min;

    // If the first argument is a pin it means there is no left shoulder
    // and it means whatever left-shoulder state we had, still is.
    var l_holey = arguments[0] === ___ ? _l_holey : false ;
    var r_holey = false;

    var i = 0;
    var is_delayed_execution = false;
    var stock = l_stock;
    var argument;
    var stock_i = l_min;
    var incby = 1;
    var endloop = arguments_count;
    // var stock_i_limit = r_min + 1;
    var stock_i_limit = stock.length;
    var hole_count = l_holey;
    var _hole_count = _l_holey;
    process_l_arguments:
    for(; i !== endloop; i += incby) {
      // console.log('\nITERATION START\nEnd when: %d !== %d | stock_i: %d', i, endloop, stock_i);
      argument = arguments[i];

      if (argument === _) {
        is_delayed_execution = true;
        // If _ is last argument it has no affect
{'fraction_non_alphanumeric': 0.09344490934449093, 'fraction_numerical': 0.0018596001859600185, 'mean_word_length': 3.2021484375, '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': '5172556', 'n_tokens_mistral': 1383, 'n_tokens_neox': 1347, 'n_words': 462}