Why prefer Gödel's β-function to Cantor's pairing function on coding number sequences This is an excerpt from Hodel's logic book.Cantor’s functions $J, K,$ and $L$ recursively code all ordered pairs. In addition, the functions $J_n$ and $J_{n,1},...,J_{n,n}$  recursively code all $n$ tuples, $n \geq2$.There is,however, a drawback to this method of coding: Each of the functions $J_n$ is onto. This means that every $c\in\mathbb N$ is the code of a pair, of a triple, and so on; in other words, there is the problem of overlap. We now introduce Gödel's β-function, a 2-ary recursive function that allows us to recursively code n-tuples so that the following holds:If $c$ is the code of an n-tuple $(a_1,...,a_n)$ and also the code of an m-tuple $(b_1,...,b_m)$ then $n=m$ and $a_k=b_k$....Gödel's β-function is now used to recursively code n-tuples. Fix $n\geq1$ and $a_1,...,a_n\in\mathbb N$. Apply Gödel's β-function to $n, a_1,...,a_n$; there is a number $c$ such that $β(c, 0) = n$ and $β(c, k) = a_k$ for $1\leq k\leq n$. The smallest $c$ with these two properties is the code of $a_1,...,a_n$.
According to the text, the problem of Cantor's $J_n$ is that a given number is the code of strings of different lengths, that is, the length information is not encoded. From what I can get, the whole trick of β-function method is placing the length of the string at the beginning. I deem Cantor's functions to be perfectly competent at doing this. Just take the code of $s=(a_1,...,a_n)$ to be $c=J(n,J_n(s))$, $J_1(a)=a$. Then its length could be recovered as $n=K(c)$. This would avoid all the Chinese reminder theorem business. So what's wrong with Cantor's functions? Could it be that there is no way to arrange the decoders into a single recursive function $proj$ such that $proj(c,k)=J_{n,k}(c)$ iff $K(c)=n$? 

Thanks.
 A: As you noted, any definable pairing function with definable projections can be easily extended to encode sequences in such a way that the length is definable. However, the most important feature you want to have is random access (to borrow a CS term), meaning that you want a definable extraction of the $k$-th item in the sequence, where $k$ is a free variable. This cannot be done easily using the Cantor pairing function. You can easily do it for any fixed position in the sequence, but not for a (literally) variable position. This is why Godel's β-function is ingenious.
Let's call a sequence coded using Cantor's pairing function to be a Cantor list. Note that it allows easy extraction of its length and its first item, which makes it like a singly-linked-list (a CS data structure).
However, since there is a program to extract the $k$-th item in a Cantor list, there is actually some formula defining extraction of the $k$-th item in a Cantor list! The only issue is that proving this is easiest by first using Godel-coding to show that recursive functions are definable...
