How would I find an example of such a function that maps from $\displaystyle [-1,1]$ -> $\displaystyle [0,1]$

I was thinking.. $\displaystyle q(x)$ $\displaystyle =$

$\displaystyle 0$ if $\displaystyle x$ is in $\displaystyle Q$

$\displaystyle 1$ if $\displaystyle x$ is NOT in $\displaystyle Q$

$\displaystyle x$ in $\displaystyle (0,1)$