Spivak's ambiguous popcorn function There is a question given in Michael Spivak's Calculus chapter 6 problem 1 section iv that reads as follows.
For which of the following functions $f$ is there a continuous function $\mathrm{F}$ with domain $\mathbb{R}$ such that $\mathrm{F}(x)=f(x)$ for all $x$ in the domain of $f$?
iv) $f(x)=1/q, \;x=p/q$ rational in lowest terms.
answer book says
iv)
No $\mathrm{F}$, since $\mathrm{F}(a)$ would have to be $0$ for irrational $a$, and then $\mathrm{F}$ is not continuous at $a$ is $a$ is rational. (typo intentionally reproduced from the book)
(end section)
The function was defined for rational numbers $p/q$. The function was never defined for $\mathbb{R}$. $f(x)$ for any irrational number is therefore undefined or unknown to the reader. This seems to be a sloppy example involving the popcorn function. I believe the conclusion that $f(x) = 0$ for any irrational number $x$ is not possible with the information given or maybe there is something that mathematicians know that is implied that I do not understand.
Is the function undefined for $x$ where $x$ is an irrational number? This would also result in a discontinuous function but for different reasons then what was concluded by Spivak. I also lack the understanding that the denominator $q$ can be isolated and extracted after $\mathbb{Q}$ has been mapped to $\mathbb{R}$ but that might be off topic. The domain is given as $\mathbb{R}$ not $\mathbb{Q}$.
 A: The function $ f $ is defined only for rational numbers. The function $ F $ (capital F) is a function that we are looking for - and it must be defined on all real numbers. The argument used is that if such an $ F $ exists, then it must be true that $ F(x) = 0 $, for all $ x \in \mathbb{R} \setminus \mathbb{Q} $ (all irrational numbers). Try to see why this is true on your own. But that means that for every rational number $a$, $ F $ is not continuous at $a$ (this is easy to prove).
PS I wasn't familiar with the name "popcorn function" so I did a little search... I found the late J.H. Conway's name far superior, the "Stars over Babylon" function (link)
A: There is an important distinction between $f(x)$ and $F(x)$. Here $f(x)$ has the rationals $\mathbb Q$ as its domain so is meaningless for the irrationals.
Any continuous $F(x)$ on $\mathbb R$, where $F(\frac pq)=f(\frac pq) =\frac1q$ on $\mathbb Q$, will have $\lim\limits_{x \to y} F(x)=0$ for all $y \in \mathbb R$, which clearly fails to be continuous.
