Internally, there is "FOOD" which is either "RATION" or "FRUIT". RATION have a quantity, FRUIT do not. One FOOD/RATION is described as "some food" while more than one is "# rations of food". When you pick up more FOOD which is RATION, it will combine it with any existing FOOD/RATION object (increasing the quantity), or just add that as a new item in your inventory if you have no FOOD/RATION.

So looking at the code, I'm not sure how it would destroy an existing object (the current rations) and replace them with the new one...

I'm so looking forward to Nethack on my iPhone. I've been enjoying Rogue to no end (not very good at it, though.) I saw somebody else playing it on the subway the other day: it was hard not to stand over his shoulder and kibitz!