<commit_before>
--- LuaNova's functional programming module.
-- Some functional programming tools lay around here.
module ("nova.functional", package.seeall) do

  --- Converts an array to an argument list.
  -- Here, an array means the n first elements of a table, indexed from 1 to n.
  -- The argument list works exactly like the "..." expression.
  -- @param t The table from where the argument list will be extracted.
  -- @param i Used for internal recursion. No need to worry about it.
  --          Defaults to nil, and that is ok.
  -- @return An argument list that works just like a "..." expression.
  function toargs (t, i)
    if not i then return toargs(t, 1) end
    if t[i] then return t[i], toargs(t, i+1) end
  end
  
  --- Binds a function to the given (left-most) arguments.
  -- The arguments must be passed in the apropriate order, according to the
  -- function's specification.
  -- @param f The function being binded.
  -- @param ... The bound arguments, in order.
  -- @return A function that, upon being called, does the same as f, but
  --         requires only the remaining right-most arguments that were not
  --         binded with it.
  function bindleft (f, ...)
    local args = { ... }
    return function (...)
      return f(toargs(args), ...)
    end
  end

end

<commit_msg>nova.functional.toargs -> nova.functional.arglist<commit_after>
--- LuaNova's functional programming module.
-- Some functional programming tools lay around here.
module ("nova.functional", package.seeall) do

  --- Converts an array to an argument list.
  -- Here, an array means the n first elements of a table, indexed from 1 to n.
  -- The argument list works exactly like the "..." expression.
  -- @param t The table from where the argument list will be extracted.
  -- @param i Used for internal recursion. No need to worry about it.
  --          Defaults to nil, and that is ok.
  -- @return An argument list that works just like a "..." expression.
  function toarglist (t, i)
    if not i then return toarglist(t, 1) end
    if t[i] then return t[i], toarglist(t, i+1) end
  end
  
  --- Binds a function to the given (left-most) arguments.
  -- The arguments must be passed in the apropriate order, according to the
  -- function's specification.
  -- @param f The function being binded.
  -- @param ... The bound arguments, in order.
  -- @return A function that, upon being called, does the same as f, but
  --         requires only the remaining right-most arguments that were not
  --         binded with it.
  function bindleft (f, ...)
    local args = { ... }
    return function (...)
      return f(toarglist(args), ...)
    end
  end

end


{'fraction_non_alphanumeric': 0.1031390134529148, 'fraction_numerical': 0.002242152466367713, 'mean_word_length': 2.4947780678851177, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7023253', 'n_tokens_mistral': 777, 'n_tokens_neox': 749, 'n_words': 361}