September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
8
Task/Forward-difference/Jq/forward-difference-1.jq
Normal file
8
Task/Forward-difference/Jq/forward-difference-1.jq
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# If n is a non-negative number and if input is
|
||||
# a (possibly empty) array of numbers,
|
||||
# emit an array, even if the input list is too short:
|
||||
def ndiff(n):
|
||||
if n==0 then .
|
||||
elif n == 1 then . as $in | [range(1;length) | $in[.] - $in[.-1]]
|
||||
else ndiff(1) | ndiff(n-1)
|
||||
end;
|
||||
3
Task/Forward-difference/Jq/forward-difference-2.jq
Normal file
3
Task/Forward-difference/Jq/forward-difference-2.jq
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
def s: [90, 47, 58, 29, 22, 32, 55, 5, 55, 73];
|
||||
|
||||
range(0;12) as $i | (s|ndiff($i))
|
||||
13
Task/Forward-difference/Jq/forward-difference-3.jq
Normal file
13
Task/Forward-difference/Jq/forward-difference-3.jq
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
$ jq -c -n -f forward-difference.jq
|
||||
[90,47,58,29,22,32,55,5,55,73]
|
||||
[-43,11,-29,-7,10,23,-50,50,18]
|
||||
[54,-40,22,17,13,-73,100,-32]
|
||||
[-94,62,-5,-4,-86,173,-132]
|
||||
[156,-67,1,-82,259,-305]
|
||||
[-223,68,-83,341,-564]
|
||||
[291,-151,424,-905]
|
||||
[-442,575,-1329]
|
||||
[1017,-1904]
|
||||
[-2921]
|
||||
[]
|
||||
[]
|
||||
Loading…
Add table
Add a link
Reference in a new issue