I don't really know how the recsys literature deals with this (I can't think of too many papers offhand that used the non-independent version, and if they interacted with this issue at all it didn't leave an impression on me). I think in general information retrieval contexts, recall is independent of list size (since list size is normally determined situationally, not statically) so if you have 10 possible items and you pull up 5 items (all good) you get 1.0 precision and 0.5 recall, telling you that the list is good, but too short and you could do "better" if you returned more answers.

Im also not sure what to put for a comment, my intuition here says that this is the right function, but I don't have anything to cite (offhand, and its not worth a lit review for one line of code right now) to convince others.

I suppose if we want to look at the CROC and GROC paper they do explicitly talk about how even a perfect recommender cannot have perfect recall/precision curves. Although I think their solution is to leave recall and precision as defined classically and simply plot "perfect" for comparison.