Would something like the above code be on your interview? (pow = 1 : [ 2*x | x <- pow])
I'd probably fail it even though I do understand recursion. I don't know Haskell, and the above is rather cryptic to me. I can infer that it raises 2 to a power, but I'm not sure how it works -- both in how it's called (does that define a function? Pow(4) --> 16?) and the why (the last part defines the recursion I assume, but what happens when you need multiple args, and what does it mean?)
If the interviewer is not giving the opportunity that the code is just plain wrong and assures it's correct (which I say upfront) then people can be 'wrong' saying it takes an argument x and get the 2^ or it prints the number of 2^argument or that it will just infinitely loop. All of these are fine with me; you read the code and at least got the gist. It's not brilliant because the list comprehension looks like most list comprehensions in other languages so then you can know pow makes a list which elements are (ordered) 2^[1..n] numbers.
Edit: But to answer your question: yes, I would like to be asked. I did a lot of interviews from the employee side just because I was curious, and, at least in the Netherlands, they never gave me a test. Just looked at my (possibly fake if I wanted) credentials and said yes/no. No tests, at all.
I'd probably fail it even though I do understand recursion. I don't know Haskell, and the above is rather cryptic to me. I can infer that it raises 2 to a power, but I'm not sure how it works -- both in how it's called (does that define a function? Pow(4) --> 16?) and the why (the last part defines the recursion I assume, but what happens when you need multiple args, and what does it mean?)