<commit_before>defmodule Function do
  @moduledoc """
  A set of funtions for working with functions.

  We can have two types of captures functions: external and local.
  External functions are functions residing in modules that are captured
  with `&/1`, such as `&String.length/1`. Local are the anonymous functions
  defined with `fn/1` or with the capture operator `&/1` using `&1`, `&2`
  and so on as replacements.
  """

  @type information ::
          :arity
          | :env
          | :index
          | :module
          | :name
          | :new_index
          | :new_uniq
          | :pid
          | :type
          | :uniq
  @type value :: any

  @doc """
  Captures a function by a given `module`, `function_name` and `arity`.

  Inlined by the compiler.

  ## Examples

      iex> Function.capture(String, :length, 1)
      &String.length/1

  """
  @since "1.7.0"
  @spec capture(module, atom, integer) :: fun
  def capture(module, function_name, arity) do
    :erlang.make_fun(module, function_name, arity)
  end

  @doc """
  Returns a keyword list with information about a function.

  The `{key, value}`s will include the following:

    * `:type` - `:local` (for anonymous functions) or `:external` (for
  named functions)
    * `:module` - an atom - the module where the function is defined when
    anonymous or the module which the function refers to when it's a named one.
    * `:arity` - the number of arguments the function is to be called with
    * `:name` - the name of the functions
    * `:env` - a list of the environment or free variables. For named
      functions, the returned list is always empty.

  When it is an anonymous function it will also return info about:
    * `:pid` - process identifier of the process that originally created
  the funciton
    * `:index` - an integer - is an index into the module function table.
    * `:new_index` - an integer - is an index into the module function table.
    * `:new_uniq` - a binary - it's a unique value for this function. It is
      calculated from the compiled code for the entire module.
    * `:uniq` - an integer, a unique value for this function. This integer is
      calculated from the compiled code for the entire module.

  **Note**: this function must be used only for debugging purposes.

  Inlined by the compiler.

  ## Examples

      iex> fun = fn x -> x end
      iex> info = Function.info(fun)
      iex> Keyword.get(info, :arity)
      1
      iex> Keyword.get(info, :type)
      :local

  """
  @since "1.7.0"
  @spec info(fun) :: [{information, value}]
  def info(fun), do: :erlang.fun_info(fun)

  @doc """
  Returns a tuple of information about the function in the form
  `{:info, information}`.

  For any function, the information asked for can be any of the atoms
  `:module`, `:name`, `:arity`, `:env`, or `:type`.<commit_msg>Fix function typos (#7507)<commit_after>defmodule Function do
  @moduledoc """
  A set of functions for working with functions.

  We can have two types of captured functions: external and local.
  External functions are functions residing in modules that are captured
  with `&/1`, such as `&String.length/1`. Local are the anonymous functions
  defined with `fn/1` or with the capture operator `&/1` using `&1`, `&2`
  and so on as replacements.
  """

  @type information ::
          :arity
          | :env
          | :index
          | :module
          | :name
          | :new_index
          | :new_uniq
          | :pid
          | :type
          | :uniq
  @type value :: any

  @doc """
  Captures a function by a given `module`, `function_name` and `arity`.

  Inlined by the compiler.

  ## Examples

      iex> Function.capture(String, :length, 1)
      &String.length/1

  """
  @since "1.7.0"
  @spec capture(module, atom, integer) :: fun
  def capture(module, function_name, arity) do
    :erlang.make_fun(module, function_name, arity)
  end

  @doc """
  Returns a keyword list with information about a function.

  The `{key, value}`s will include the following:

    * `:type` - `:local` (for anonymous functions) or `:external` (for
  named functions)
    * `:module` - an atom - the module where the function is defined when
    anonymous or the module which the function refers to when it's a named one.
    * `:arity` - the number of arguments the function is to be called with
    * `:name` - the name of the functions
    * `:env` - a list of the environment or free variables. For named
      functions, the returned list is always empty.

  When it is an anonymous function it will also return info about:
    * `:pid` - process identifier of the process that originally created
  the function
    * `:index` - an integer - is an index into the module function table.
    * `:new_index` - an integer - is an index into the module function table.
    * `:new_uniq` - a binary - it's a unique value for this function. It is
      calculated from the compiled code for the entire module.
    * `:uniq` - an integer, a unique value for this function. This integer is
      calculated from the compiled code for the entire module.

  **Note**: this function must be used only for debugging purposes.

  Inlined by the compiler.

  ## Examples

      iex> fun = fn x -> x end
      iex> info = Function.info(fun)
      iex> Keyword.get(info, :arity)
      1
      iex> Keyword.get(info, :type)
      :local

  """
  @since "1.7.0"
  @spec info(fun) :: [{information, value}]
  def info(fun), do: :erlang.fun_info(fun)

  @doc """
  Returns a tuple of information about the function in the form
  `{:info, information}`.

  For any function, the information asked for can be any of the atoms
  `:module`, `:name`, `:arity`, `:env`, or `:type`.
{'fraction_non_alphanumeric': 0.10265827212311997, 'fraction_numerical': 0.005946135012242042, 'mean_word_length': 2.713636363636364, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '6856669', 'n_tokens_mistral': 1720, 'n_tokens_neox': 1666, 'n_words': 726}