You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Strangely, I had never thought of this. Probably many other languages check the same ordering too!
It seems OK to use shouldMatchList, if all we are asking in the problem is "which of these words are anagrams?"
I am sure there are various arguments for why it makes sense to keep the output in the same order as the input (and my implementations will probably keep it so) but I don't think it is essential to the problem that it has to be that way.
I agree, too. Have the test suite as general as possible to allow for as many solutions as possible. In the end we want to explore those possible solutions for the maximum learning effect and not be arbitrarily restricted.
A user suggested that we could change
anagram
's test suite to check the output list ignoring the word's order.The way it is now,
anagramsFor word
must behave asfilter p
to pass the tests.The patch would be really simple,
sed -i 's/shouldBe/shouldMatchList/g' test/Tests.hs
... but first we have to decide if it is important to check the output order.
Does anyone have an opinion on this?
The text was updated successfully, but these errors were encountered: