<commit_before><commit_msg>unfoldr.rb: i don't remember what is this, but just for a record<commit_after>
def list_unfoldr func, input, result = []
  if value = func[input]
    list_unfoldr(func, value.last, result << value.first)
  else
    result
  end
end

def query input
  list_unfoldr(lambda{ |value|
    if value == 0
      nil
    else
      [value, value - 1]
    end
  }, input)
end

p query(10)

{'fraction_non_alphanumeric': 0.10098522167487685, 'fraction_numerical': 0.009852216748768473, 'mean_word_length': 2.9901960784313726, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4897249', 'n_tokens_mistral': 149, 'n_tokens_neox': 144, 'n_words': 46}