Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,10 @@
def is_integral:
if type == "number" then . == floor
elif type == "array" then
length == 2 and .[1] == 0 and (.[0] | is_integral)
else type == "object"
and .type == "rational"
and .q != 0
and (.q | is_integral)
and ((.p / .q) | is_integral)
end ;

View file

@ -0,0 +1,4 @@
(
0, -1, [3,0], {"p": 4, "q": 2, "type": "rational"},
1.1, -1.1, [3,1], {"p": 5, "q": 2, "type": "rational"}
) | "\(.) => \(if is_integral then "integral" else "" end)"

View file

@ -0,0 +1,9 @@
$ jq -r -n -f is_integral.jq
0 => integral
-1 => integral
[3,0] => integral
{"p":4,"q":2,"type":"rational"} => integral
1.1 =>
-1.1 =>
[3,1] =>
{"p":5,"q":2,"type":"rational"} =>