Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
16
Task/Text-processing-2/Jq/text-processing-2-2.jq
Normal file
16
Task/Text-processing-2/Jq/text-processing-2-2.jq
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
# Given any array, produce an array of [item, count] pairs for each run.
|
||||
def runs:
|
||||
reduce .[] as $item
|
||||
( [];
|
||||
if . == [] then [ [ $item, 1] ]
|
||||
else .[length-1] as $last
|
||||
| if $last[0] == $item then (.[0:length-1] + [ [$item, $last[1] + 1] ] )
|
||||
else . + [[$item, 1]]
|
||||
end
|
||||
end ) ;
|
||||
|
||||
def is_float: test("^[-+]?[0-9]*[.][0-9]*([eE][-+]?[0-9]+)?$");
|
||||
|
||||
def is_integral: test("^[-+]?[0-9]+$");
|
||||
|
||||
def is_date: test("[12][0-9]{3}-[0-9][0-9]-[0-9][0-9]");
|
||||
Loading…
Add table
Add a link
Reference in a new issue