Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,16 @@
# Generate a stream of subsets of the input array
def subsets:
if length == 0 then []
else .[0] as $first
| (.[1:] | subsets)
| ., ([$first] + .)
end ;
# Generate a stream of non-continuous indices in the range 0 <= i < .
def non_continuous_indices:
[range(0;.)] | subsets
| select(length > 1 and length != 1 + .[length-1] - .[0]) ;
def non_continuous_subsequences:
(length | non_continuous_indices) as $ix
| [.[ $ix[] ]] ;

View file

@ -0,0 +1,3 @@
def count(f): reduce f as $i (0; . + 1);
count( [range(0;20)] | non_continuous_subsequences)