# Primitive recursive select from parameters

I'm looking forward function, that works like that $\mathbb{N}^{n+1} \rightarrow \mathbb N$:

$f(y, x_1, x_2, \dots ,x_n)=x_y$

We use projection $\Pi^n_k$, but I need something with "dynamic" size and parameters. I need it for writing primitive version of summation of n numbers. I have seen this function in some proofs like http://www.proofwiki.org/wiki/Bounded_Summation_is_Primitive_Recursive , but I haven't seen it's definition

Thank you

-

I have already solved this problem. I use $n$ as constant parameter. so the $f$ as $\mathbb N^{n+1} \rightarrow \mathbb N$ function is defined: $$f(\bar x, y)= \Pi^{n+1}_n (f'(\bar x, y))$$ $$f'(\bar x, 0)=(\Pi^{n+1}_2 \times \Pi^{n+1}_3 \times \dots \times \Pi^{n+1}_n \times \Pi^{n+1}_1 ) (\bar x)$$ $$f'(\bar x, y+1)=(\Pi^{n+1}_2 \times \Pi^{n+1}_3 \times \dots \times \Pi^{n+1}_n \times \Pi^{n+1}_1 ) (f'(\bar x,y))$$
The standard trick uses the Gödel $\beta$-function to encode sequences of variable length.