Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
15
Task/File-size-distribution/Jq/file-size-distribution.jq
Normal file
15
Task/File-size-distribution/Jq/file-size-distribution.jq
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# bag of words
|
||||
def bow(stream):
|
||||
reduce stream as $word ({}; .[($word|tostring)] += 1);
|
||||
|
||||
# `stream` is expected to be a stream of non-negative numbers or numeric strings.
|
||||
# The output is a stream of [bucket, count] pairs, sorted by the value of `bucket`.
|
||||
# No sorting except for the sorting of these bucket boundaries takes place.
|
||||
def histogram(stream):
|
||||
bow(stream)
|
||||
| to_entries
|
||||
| map( [(.key | tonumber), .value] )
|
||||
| sort_by(.[0])
|
||||
| .[];
|
||||
|
||||
histogram(.[] | .size | if . == 0 then 0 else 1 + (log10 | trunc) end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue