The reals as continuous image of the irrationals In the Wikipedia article about descriptive set theory I read that $\mathbb{R}$ (with its usual topology) is a Polish space, and that every Polish space 
1) can be obtained as a continuous image of the Baire space $\mathcal{N}$
2) can be obtained as the image of a continuous bijection defined on a closed subset of the Baire space. 
Then I learn from the Wikipedia article on Baire space that it is actually homeomorphic to the irrational numbers with their usual subspace topology inherited from the real line.
So my questions:

Can we describe explicitly a surjective continuous map from the irrationals to $\mathbb{R}$?
Same for a continuous bijection from a closed subset of the irrationals to $\mathbb{R}$.

 A: Here's another simple explicit function that maps the irrationals onto the real numbers. It is defined on the whole real line.
Consider the continuous piece-wise linear function $f:\mathbb{R}\rightarrow\mathbb{R}$, with slope $f'(x)=-1$ or $f'(x)=+1$ according whether $\lfloor x/\sqrt 2\rfloor=0\, \mathrm{ mod} 3 $, or not (like this). So $f(x)=x/3+O(1)$ as $|x|\to\infty$ and it is therefore surjective; precisely, any of its fiber has three points, and the arithmetic mean of some two of these is an odd multiple of $\sqrt{2}$. This means that  the equation $f(x)=c$ has always an irrational solution, whatever is $c\in\mathbb{R}$.
rmk. Note that replacing $\sqrt 2$ with $\pi$ produces a map that maps the transcendental numbers onto $\mathbb{R}$.
A: A surjection from $\mathbb{N}^\mathbb{N}$ to $\mathbb{R}$ is given by
$$f \mapsto f(0) - f(1) + \sum_{k = 2}^\infty \frac{\min(f(2k),1)-\min(f(2k+1),1)}{2^{2k-4}}$$
A homeomorphism from the irrational numbers (with the Euclidean topology) to $\mathbb{N}^\mathbb{N}$ is given by the continued-fraction expansion.
The displayed map is onto, constructively. For the continued-fraction expansion map to be constructive, we need to define irrational numbers as those reals $x \in \mathbb{R}$ for which $|x - q| > 0$ for all $q \in \mathbb{Q}$ (as opposed to those reals which are not rational).
A: For the second question, remember that the subset only has to be closed in the irrationals, not as a subset of $\mathbb{R}$. With that in mind, you can take the closed subset to be the irrationals in $(-1,1)$ union some countable discrete set of irrationals. On $(-1,0)$, define $f$ by $x\mapsto \frac{1}{x}+1$; on $(0,1)$, by $x\mapsto \frac{1}{x}-1$, and on the discrete set, choose some bijection with $\mathbb{Q}$.
A: For any irrational number $x$, let $f(x)$ be the real number arising from the integer part of $x$, together with every other digit of the rest of the expansion of $x$. 
This is surjective, since one may interleave the digits of any real $y$ with any nonrepeating pattern, and thereby find an irrational $x$ with $f(x)=y$.  This is continuous, since if $x_n\to x$, then $f(x_n)\to f(x)$.
A: Let $C$ be a space-filling curve, i.e. a continuous function from $\mathbb R$ onto ${\mathbb R}^2$. Then the first component $C(t)_1$ is a continuous function from $\mathbb R$ onto $\mathbb R$ that hits each real number uncountably many times.  Since there are only countably many rationals, the restriction to the irrationals is also surjective.
A: Count the rational numbers as $(a_1,a_2,a_3,\ldots)$.  Let $f:\mathbb R\to \mathbb R$ be defined at the nonpositive integers by $f(n)=(-1)^nn$, and on the positive integer multiples of $\sqrt 2$ by $f(n\sqrt 2)=a_n$.  Let $f$ be piecewise linear between the points just defined.  Then the restriction of $f$ to $\mathbb R\setminus \mathbb Q$ is a continuous surjection from the irrationals to $\mathbb R$.
