Suppose I have a vector $\boldsymbol{x} = (x_1,x_2,\ldots,x_N)$ in $\mathbb{R}^N$. I need to express a function $\boldsymbol{y} : \mathbb{R}^N \mapsto \mathbb{R}^{M(\boldsymbol{x})}$ where $M(\boldsymbol{x}) \le N$ such that the vector $\boldsymbol{y}(\boldsymbol{x})$ contains the elements of $\boldsymbol{x}$ that are not equal to some constant $q \in \mathbb{R}$.
For example, if $$\boldsymbol{x}=(23, 17, 1, 99, 122, 17, 40)$$ and $q=17$, then $$ \boldsymbol{y}(\boldsymbol{x})=(23,1,99,122,40).$$
But I'm struggling with how to define this function $\boldsymbol{y}$. In particular, it is important that the ordering of the elements in $\boldsymbol{y}$ be the same as the ordering of the same elements in $\boldsymbol{x}$, but I don't know how notationally to express this.
How could I define this function?