Initial data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 72d218235f
commit f23f22d71c
199087 changed files with 3378941 additions and 0 deletions

View file

@ -0,0 +1 @@
[4,3,2,1,1,2,3,4] | unique

View file

@ -0,0 +1,24 @@
def removeAllButFirst:
# The hash table functions all expect the hash table to be the input.
# Is x in the hash table?
def hashed(x):
(x|tostring) as $value
| .[$value] as $bucket
| $bucket and (.[$value] | index([x]));
# Add x to the hash table:
def add_hash(x):
(x|tostring) as $value
| .[$value] as $bucket
| if $bucket and ($bucket | index([x])) then .
else .[$value] += [x]
end;
reduce .[] as $item
( [[], {}]; # [array, hash]
if .[1] | hashed($item) then .
else [ (.[0] + [$item]), (.[1] | add_hash($item)) ]
end)
| .[0];