Index finite lists of positive integers: Difference between revisions

Content added Content deleted
(→‎{{header|jq}}: bijection and compactness)
(→‎jq: not bijective)
Line 586: Line 586:


For example: 1 2 3 => 11 011 0011 => 110110011 => 110011011
For example: 1 2 3 => 11 011 0011 => 110110011 => 110011011

Since the binary string so obtained is a positive integer,
it can be seen that the mapping implicitly defined here (between positive integers and
lists of positive integers) is in fact bijective, and is more compact
than the binary 'n 1s' encoding.


The Go implementation of jq and, as of version 1.6, the C
The Go implementation of jq and, as of version 1.6, the C