When I take the time to test solutions of competitors, I sometimes find failing answers, which not even solve the examples.
I don't want to discuss a certain question and its solutions, but we all prefer concrete examples - don't we? So please don't take it personal.
For the question to spoonerize words, we got the examples:
Example: A lack of pies = A pack of lies. Bad salad = Sad ballad (ish) :)
3 of the early solutions produced lA pack of ies
, 2 of them ruby, 1 perl. I didn't test the haskell, J and C# solution, because I don't have them installed.
It's not the first time, that I stumbled over easy to find bugs. Of course, it is always hard to avoid all traps from complicated border cases, but such obvious failings?
In my opinion we should be honest in providing only answers which work, or disclosure ourselves known shortcomings.
My voting policy is normally to upvote every answer which is better than my own one, but I would like to be sure to only vote on working solutions. I don't want to install every competing language on my machine, to perform basic tests on code, I can only guess about (haskell, J, C# for me - maybe Scala, bash for you).
And I suggest to routinely test competing code. If we allow too much errors, the answers which only pretend to solve the puzzle will win.
Fun and entertainment only work, if you take it seriously. :)
update:
Well - maybe my view is too much biased from my first interpretation of what the challenge is, and the other people did not provide faulty answers, but just interpreted the question in a different manner. I can hardly leave my perspective, but I have to admit, that my interpretation of the question can be questioned.
... Write a program to spoonerise two words ...
In this case, my whole concern shrinks, and becomes: Don't answer ambigious questions, but wait for the master of the game to clarify the meaning, maybe by downvoting and voting to close.
1. If the first letter is a consonant, you must include the preceding letters until you reach a vowel. (e.g. 'thanks' - the th gets removed and put on the front of the other word). 2. With words that start with vowels, do not remove anything from the start of the word.
\$\endgroup\$if the first letter is a consonant
implies, that there are cases, where it isn't. \$\endgroup\$