<commit_before>class Hamming
  def self.compute(strand1, strand2)
    new(strand1, strand2).distance
  end

  attr_reader :strand1, :strand2
  def initialize(strand1, strand2)
    @strand1 = strand1
    @strand2 = strand2
  end

  def distance
    common_pairs.count do |pair|
      mutation?(*pair)
    end
  end

  private

  def common_pairs
    sequence1.chars.zip(sequence2.chars)
  end

  def sequence1
    strand1[0..common_length]
  end

  def sequence2
    strand2[0..common_length]
  end

  def common_length
    [@strand1.length, @strand2.length].min - 1
  end

  def mutation?(a, b)
    a != b
  end<commit_msg>Simplify ruby hamming example<commit_after>class Hamming
  def self.compute(strand1, strand2)
    (0...[strand1.length, strand2.length].min).count do |i|
      strand1[i] != strand2[i]
    end
  end
{'fraction_non_alphanumeric': 0.10109622411693057, 'fraction_numerical': 0.03654080389768575, 'mean_word_length': 3.0693069306930694, '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': '4209994', 'n_tokens_mistral': 325, 'n_tokens_neox': 289, 'n_words': 67}