Hello
exercise: parallel-letter-frequency
The sequential implementation used behind “test_faster_than_serialized_answer” test must also pass itself the entire test suite. This is not the case today.
This relates to the use of “each_grapheme_cluster”.
The following solution allows the tests to pass. However, it is maybe not optimal (matching every character, meh…).
Perhaps it would be better to keep “each_grapheme_cluster” and modify the test suite?
Wdyt?
def sequential_letter_frequency(texts)
tally = Hash.new(0)
texts.each do |text|
text.each_char do |char|
tally[char.downcase] += 1 if char.match?(/\p{L}/)
end
end
tally
end