Is the definition of limits valid when talking about discret functions This question is related to this other one I just made here. Let's consider for example the function $f:\mathbb{Q}\longrightarrow \mathbb{R}$ such that $f(x)=x$. Intuitively $\lim_{x\to 0 }f=0$. 
Now my problem is that I don't understand the domain of a function so I can talk about the definition of limit. According to the definition here, the funciton $f$ needs to be of the form $f:I\longrightarrow \mathbb{R}$, where $I$ is an open interval. Then my function defined above doesn't have limit.
According to spivak's book, see here for the definition, I understand that there's no need for the function to be defined on an interval $I$ but there should exist $\delta>0$ to apply the conditions of $\lim$, namely $\lim_{x\to c}f=l$ if and only if $\forall\epsilon>0\exists\delta>0\forall x(0<|x-c|<\delta\longrightarrow |f(x)-l|<\epsilon)$.   So in this case I think my function above has limit, though it's still not very clear to me because Spivak says this as a comment. 
Questions: Does this function have limit at all its rational values? What are the conditions on the domain of $f$ so I can apply the defintion of limit?

EDIT: I'd like to add this to my question. Let's consider the example above. The definition says that: 
$\lim_{x\to c}f=c$ if and only if $\forall\epsilon>0\exists\delta>0\forall x(0<|x-c|<\delta\longrightarrow |f(x)-l|<\epsilon)$
Translated to my example I would say that: 
$\lim_{x\to 0}f=0$ if and only if $\forall\epsilon>0\exists\delta>0\forall x(0<|x-0|<\delta\longrightarrow |f(x)-0|<\epsilon)$
Question: what is the domain of $x$? if the domain of $x$ is $\mathbb{R}$ then the conditions in the definition are never satisfied because for all $\delta>0$ there is always an irrational number $x$ such $|x-0|<\delta$ but $|f(x)-l|<\epsilon$ does not hold because $f$ is only defined for rational numbers. If the domain of $x$ is $Dom(f)$ then the conditions are satisfied and it seems that $lim_{x\to 0}=0$.   
 A: The $\epsilon-\delta$ definition of limits is best understood in the context of metric spaces, rather than the context of the particular metric space $\mathbb R$ with its metric given by $d(x,y)=|x-y|$. A metric space is a pair $(X,d)$ where $X$ is a set and $d:\times X\times X\to \mathbb R$ is a function satisfying $d(x,y)=0\iff x=y$, $d(x,y)=d(y,x)$, and $d(x,z)\le d(x,y)+d(y,z)$, for all $x,y,z\in X$. 
Then, if $X$ and $Y$ are metric spaces (each with its own $d$), a $f:X\to Y$ is a function then $f$ is said to have the limit $L\in Y$ at the point $x\in X$ if for all $\epsilon >0$ there exists $\delta >0$ such that for all $x'\in X$ with $x\ne x'$, if $d(x,x')<\delta $, then $d(f(x),L)<\epsilon$. 
In particular, $\mathbb R$ with $d(x,y)=|x-y|$ is a metric space and $\mathbb Q$ with $d(x,y)=|x-y|$ is also a metric space. The notion of limits for functions $f:\mathbb R\to \mathbb R$ is the same whether you consider the definition you refer to in your question, or if you think of the domain and codomain as metric spaces. Now, the case of functions $f:\mathbb Q \to \mathbb R$ can simply be treated, for limit purposes, as functions between metric spaces. In particular, the function you mention above does satisfy $\lim_{x\to 0}f(x)=0$. 
So, the function you mention does have a limit at all of its points of definition. In fact, the function is continuous. Further, as the above would indicate, to speak of the $\epsilon-\delta$ notion of limits, the domain and codomain of the function can be any two metric spaces. 
Answer to the EDIT: The domain of the $x$, in the context of real analysis (that is, when the metric spaces in question are subspaces of $\mathbb R$, the domain where $x$ is allowed to come from is usually assumed to be some given interval of the point $x$ where the limit is computed. The reason is that most theorem of the calculus that relate to differentiability require the function to be nice enough in an interval. Otherwise, annoying pathologies may pop up. 
It is healthy to think of it all in terms of germs. Without getting technical, germs allow for the following observation to become a rigorous. The limit of a function $f$ at a point $x$, does not depend at all on the value $f(x)$. Moreover, the limit also does not depend at all on what happens with the function outside an interval $(x-t,x+t)$, no matter how small $t>0$ is. So, it would seem that the limit of a function doesn't depend on any particular value of the function. This apparent paradoxical situation is something that is good to ponder about. The rigorous solution is given in the forms of the germ of the function at $x$. But even without googling what that is, it's a good idea to come to grips with this observation. 
A: Yes the function has limit at all its rational values. Parsing through the definition, fix a rational number $q$ also equal to $f(q)$ if you choose any small positive $\epsilon$ and a rational number $y$ such that $| f(y)-q| < \epsilon$ then you can choose $\delta = \epsilon$ (because your function $f$ takes a number to itself) and that choice of $\delta$ works. 
If your function were $f(x) = x^{3}$, your choice of $\delta$ will be somewhat different. 
All this works because the rational numbers are dense in the reals that is any real number is a limit of rational numbers, so no matter how small $\delta$ is you can always find a rational number nearby (to $c$).
EDIT:To clarify, "All this works..." is meant to imply that given a function $f: \mathbb{R} \rightarrow \mathbb{R}$ you can check the continuity of $f$ at a rational point $x$ (which is zero in your case) by restricting yourself to the (restricted) function $f: \mathbb{Q} \rightarrow \mathbb{R}$ and using the epsilon delta definition of Spivak. However given a function $f: \mathbb{R} \rightarrow \mathbb{R}$, you cannot check continuity at $0$ by restricting the function to $f:\mathbb{N} \rightarrow \mathbb{R}$ (and this is where density of rationals is important).   
I hope that clarifies my last comment. 
