Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,21 +1,19 @@
|
|||
func$ mkrange arr[] .
|
||||
idx = 1
|
||||
idx2 = 1
|
||||
while idx <= len arr[]
|
||||
repeat
|
||||
idx2 += 1
|
||||
until idx2 > len arr[] or arr[idx2] - arr[idx2 - 1] <> 1
|
||||
func$ extract l[] .
|
||||
for i to len l[]
|
||||
low = l[i]
|
||||
while i < len l[] and l[i] + 1 = l[i + 1]
|
||||
i += 1
|
||||
.
|
||||
if idx2 - idx > 2
|
||||
r$ &= arr[idx] & "-" & arr[idx2 - 1] & ","
|
||||
idx = idx2
|
||||
hi = l[i]
|
||||
if hi - low >= 2
|
||||
r$ &= low & "-" & hi & ","
|
||||
elif hi - low = 1
|
||||
r$ &= low & ","
|
||||
r$ &= hi & ","
|
||||
else
|
||||
while idx < idx2
|
||||
r$ &= arr[idx] & ","
|
||||
idx += 1
|
||||
.
|
||||
r$ &= low & ","
|
||||
.
|
||||
.
|
||||
return substr r$ 1 (len r$ - 1)
|
||||
.
|
||||
print mkrange [ 0 1 2 4 6 7 8 11 12 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 39 ]
|
||||
print extract [ 0 1 2 4 6 7 8 11 12 14 15 16 17 18 19 20 21 22 23 24 25 27 28 29 30 31 32 33 35 36 37 38 39 ]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue