5 ms·
As I read the article and the comments I thought "how would I reverse a linked list?" Turns out it is pretty straight-forward in Erlang: lists:reverse(List).
by gordonguthrie 15y ago
As I read the article and the comments I thought "how would I reverse a linked list?"
Turns out it is pretty straight-forward in Erlang:
lists:reverse(List).
Reading their contributions on github is a much better way to get a sense of someones capabilities.
- eru 15y agoYou could just ask: How is lists:reverse(List) implemented in Erlang, or if you don't know it, how could it be implemented? What are the trade-off and limitations for different implementations? Since most abstractions are leaky, you can make a good argument, that learning how libraries tick, even if you are never going to rewrite them, is a useful skill.
- gordonguthrie 15y agoBut I want to find developers who will help me deliver the business objectives. Rewriting list reversal code doesn't do that.
- eru 15y agoUnderstanding the limitations of libraries might help you use those libraries better. Using libraries can be a part of delivering business objectives. I don't think that list reversal is a good interview question. At least not as a positive discriminator. Though it might help you weed out people: I'd probably not want to hire people who can't figure out how to reverse a list. If they'll stumble upon such a simple problem, they might also stumble over the more complicated problems we have to solve to deliver business objectives. I wrote `can't figure out' deliberately. Not knowing how to reverse a linked list, but being able to come up with an algorithm after a few minutes thought is perfectly adequate.
- gordonguthrie 15y agoI agree with you - it is a weeder-outer, but not an includer-inner - there are lots of people who can write code to reverse linked-lists that I don't want to hire. In particular I don't want to hire the people who would rather write their own implementation than use a library (think Not-Invented-Here and Yak Shaving).
- eru 15y agoIndeed. By the way, in purely functional implementations of a list reversal there are non-trivial trade-offs to make. (See Janestreet's standard libraries for OCaml.)
- rhizome 15y agoMy interview strategy as a Rails dev: reversed = File.open('list.txt').gsub(/[\n\r]/'').split.reverse I don't need to write Ruby in C.