September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,11 @@
|
|||
def f:
|
||||
def abs: if . < 0 then -. else . end;
|
||||
def power(x): (x * log) | exp;
|
||||
. as $x | abs | power(0.5) + (5 * (.*.*. ));
|
||||
|
||||
. as $in | split(" ") | map(tonumber)
|
||||
| if length == 11 then
|
||||
reverse | map(f | if . > 400 then "TOO LARGE" else . end)
|
||||
else error("The number of numbers was not 11.")
|
||||
end
|
||||
| .[] # print one result per line
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
$ echo "Enter 11 numbers on one line; when done, enter the end-of-file character:" ;\
|
||||
jq -M -s -R -f Trabb_Pardo-Knuth_algorithm.jq
|
||||
> Enter 11 numbers on one line; when done, enter the end-of-file character:
|
||||
1 2 3 4 5 6 7 8 9 10 11
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
"TOO LARGE"
|
||||
322
|
||||
136.73205080756887
|
||||
41.41421356237309
|
||||
6
|
||||
Loading…
Add table
Add a link
Reference in a new issue