Index finite lists of positive integers: Difference between revisions

Content added Content deleted
m (→‎{{header|jq}}: (currently))
Line 587: Line 587:
For example: 1 2 3 => 11 011 0011 => 110110011 => 110011011
For example: 1 2 3 => 11 011 0011 => 110110011 => 110011011


The Go implemenation of jq and, as of version 1.6, the C
The Go implementation of jq and, as of version 1.6, the C
implementation both support arbitrarily large literal integers, and
implementation both support arbitrarily large literal integers, and
the `tonumber` filter retains precision allowing seamless
the `tonumber` filter retains precision allowing seamless
Line 596: Line 596:
The following is slightly more verbose than it need be but for
The following is slightly more verbose than it need be but for
the sake of compatibility with jaq. Also note that trivial
the sake of compatibility with jaq. Also note that trivial
changes would be required if using jaq as jaq does not support
changes would be required if using jaq as jaq does not (as of this writing in 2024) support
the `include` or `module` directives.
the `include` or `module` directives.
<syntaxhighlight lang="jq">
<syntaxhighlight lang="jq">
include "fibonacci" {search: "./"}; # see https://rosettacode.org/wiki/Category:Jq/fibonacci.jq
include "fibonacci" {search: "./"}; # see https://rosettacode.org/wiki/Category:Jq/fibonacci.jq

# Input: an array of integers
# Input: an array of integers
# Output: an integer-valued binary string, being the reverse of the concatenated Fibonacci-encoded values
# Output: an integer-valued binary string, being the reverse of the concatenated Fibonacci-encoded values