I have gotten quite complacent about using the same language for solving programming challenge problems such as those on HackerRank
. I wanted to take a problem and write the solution in multiple languages to get a feel for them and see if there are any that I prefer to the one that I normally use (ignoring performance considerations for the time being).For this personal challenge, I chose the Zombie March
I don't claim to be good in any of them (with the exception of one perhaps) so I'm sure I've done plenty of non-idiomatic and otherwise silly things.Full sources are available on GitHub
and each individual solution is linked as well.
In no particular order...
A nice upgrade from C but too low level for my preference.
Saves you from some of the hair-pulling that one might encounter when writing (or debugging) C code as it's much easier to write safe code.
Compilation speed is fast (at least on my silly code).
"Declared and not used” being an error is a bit too much for someone just playing around but I can see how it could be useful in a real Go program.
Syntax is nice, rich collections, everything is an object. Not a lot of surprises.
Nice, but a bit turned off on how collection operations are performed.
Can't invoke operations like map, filter, etc directly on a collection.
concise but that's not strictly a Scala problem.
Some of the syntax may take getting used to.
No generic array instantiation. Had to create a separate class to avoid having an Object array.
Parsing input is a pain. Limited collection operations and no lambdas.
Limited collection operations. Some operations mutate in place and don't appear to have immutable alternatives (sort, reverse).
Was really taken by surprise that sorting an array of floats sorts them in alphabetical order.
Failed some of the test cases (didn't have time to figure out why).
Clojure took the most time to figure out.
Parsing the input data was the biggest challenge and I don't think I did it in a particularly nice way. I'll need to come back to it.
Some of the exceptions that I encountered were a little cryptic and took time to figure out.
Apart from the learning curve, it seems to be a nice language.
Was able to write the solution in a more functional way than I could with Java.
Encountered a strange issue where the reader passed by inputStream.withReader would return extra blank lines.
Didn't pass two of the test cases as it took too long to run. (Didn't spend any time profiling).