The instructions for the word count exercise on the elixir track, seem to conflict with the tests, in terms of implied specification.
As such, if you try to write a solution based just on the requirements described in the introduction, your code will fail - at least this was my experience, although I may be misunderstanding the intended meaning of the instructions.
The two (suspected) discrepancies that I’ve found are as described below.
Discrepancy 1: Required Character Sets
From instructions.md :
I took that to mean, “your solution only needs to be concerend with ascii characters”.
In word_count_test.exs however, there are tests that require the solution to deal with German and Polish scripts:
Discrepancy 2: Allowed punctuation that doesn’t split words
From instructions.md:
The only punctuation that does not separate words is the apostrophe in contractions.
However in word_count_tests.exs, this test requires that a hyphen be allowed in the middle of a word:
If only apostrophes should be allowed in the middle of words, then I would have expected co
and operative
to be split into two separate map keys.
History of exercise (rough)
Having looked at the commit history, I found that the order of changes is basically:
- 9 years ago: test requiring hyphens to not split words added
- 3 years ago: german, polish script requiring tests added
- 6 months ago: instructions.md was edited to include statements that seem to go against the requirements as described above.
So, the “easier” specification implied by instructions.md seems to have been made later, which implies the “harder” specification of the tests is the original and therefore arguably “correct”.
The exercise is however categorized as easy though, and it also seems very possible that the specifications were intentionally simplified at some point, with the tests being left out of the update process by chance.
Can anyone tell me which way would be the right way to unify these two? Or if I’m mistaken and there’s no contradiction between them :)