News for hackers. Stuff that matters.
Re:Embarrassing code I wrote under stress at a job interview by S4M on Saturday May 02, 2015 @08:13PM (#9479130)
I think the OP made the mistake of trying to solve the problem directly, and when he got errors, he got nervous which made him get more errors. Instead the right strategy would be to think aloud "well, how do I get the digits of a number? first, cast the number into a string then try to see if I can treat it as a list. Ok, let's try (seq (str 10)) on the repl....". Having an instant feedback and being able to no exactly if a small instruction works or not would have helped him to focus better, and avoid nervousness.
Re:Embarrassing code I wrote under stress at a job interview by shortly on Saturday May 02, 2015 @08:52PM (#9479266)
that he did not take this approach makes me think the candidate is inexperienced, and probably coming to clojure from an imperative mindset.
Re:Embarrassing code I wrote under stress at a job interview by tonyarkles on Saturday May 02, 2015 @09:21PM (#9479348)
Yeah, that's exactly what I look for in problems like that. How does this person approach the problem? How do they decompose the problem?

For that specific problem, I'd probably be satisfied if they wrote a function that took a number like 341 and returned [3, 4, 1], and then mumbled something about a set or a hash (or a list even) for storing the already seen numbers.