wow, nicely done :)
Thanks, I learnt that there's a isSpace function now. And some more is-functions on hackage. Although I used (/= ' ') I still appreciate these builtin functions which you actually know what's going on by their name.
One should implement its own argmax.
Edited: Oh! One could do reverse before words.
This code is in fact not correct, because maximumBy will not return the first element with highest score but the final one.
For example, if we use the test "ab ba" (which should return "ab"), the code cannot pass.
Yes, 'map length' is a function that takes only one argument: a list (it is only partially evaluated). Hence 'map length . words' takes only a string as an argument and so on.
Great use of this property!
That's impressive, I often forget that there probably is some hidden pattern that I can leverage. Good one :).
This comment is hidden because it contains spoiler information about the solution
it returns "error", if key is wrong.
Hoogle seems not to know about Data.List.Split, and I failed to find something like splitOn. Thanks for the hint!
Two of sample tests are incorrect in Haskell translation:
it "abcdxg" $ do
middlePermutation "abcdxg" `shouldBe` "cgxdba"
it "abcdxgz" $ do
middlePermutation "abcdxgz" `shouldBe` "dczgxba"
Should be cxgdba and dczxgba