<commit_before>require_relative 'blank'

class Proc
  def self.comp(f, g)
    lambda { |*args| f[g[*args]] }
  end

  def *(g)
    Proc.comp(self, g)
  end
end

module Kleisli
  class ComposedFn < Blank
    include ::Kernel

    def initialize(fns=[])
      @fns = fns
    end

    def fn(*args, &block)
      f = -> arguments, receiver {
        block.call(receiver, *arguments)
      }.curry[args]
      ComposedFn.new(@fns + [f])
    end

    def method_missing(meth, *args, &block)
      f = -> arguments, receiver {
        receiver.send(meth, *arguments, &block)
      }.curry[args]
      ComposedFn.new(@fns + [f])
    end

    def call(*args)
      if @fns.any?
        @fns.reduce(:*).call(*args)
      else
        args.first
      end
    end<commit_msg>Don't need to include Kernel in ComposedFn<commit_after>require_relative 'blank'

class Proc
  def self.comp(f, g)
    lambda { |*args| f[g[*args]] }
  end

  def *(g)
    Proc.comp(self, g)
  end
end

module Kleisli
  class ComposedFn < Blank
    def initialize(fns=[])
      @fns = fns
    end

    def fn(*args, &block)
      f = -> arguments, receiver {
        block.call(receiver, *arguments)
      }.curry[args]
      ComposedFn.new(@fns + [f])
    end

    def method_missing(meth, *args, &block)
      f = -> arguments, receiver {
        receiver.send(meth, *arguments, &block)
      }.curry[args]
      ComposedFn.new(@fns + [f])
    end

    def call(*args)
      if @fns.any?
        @fns.reduce(:*).call(*args)
      else
        args.first
      end
    end
{'fraction_non_alphanumeric': 0.1398828887443071, 'fraction_numerical': 0.0, 'mean_word_length': 2.177685950413223, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, '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': '2730014', 'n_tokens_mistral': 570, 'n_tokens_neox': 545, 'n_words': 131}