September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -0,0 +1,5 @@
|
|||
# zip/0 emits [] if input is [].
|
||||
|
||||
def zip:
|
||||
. as $in
|
||||
| [range(0; $in[0]|length) as $i | $in | map( .[$i] ) ];
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
# transpose a possibly jagged matrix
|
||||
def transpose:
|
||||
if . == [] then []
|
||||
else (.[1:] | transpose) as $t
|
||||
| .[0] as $row
|
||||
| reduce range(0; [($t|length), (.[0]|length)] | max) as $i
|
||||
([]; . + [ [ $row[$i] ] + $t[$i] ])
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue