ostap / comp

a tool for querying files in various formats
MIT License
43 stars 2 forks source link

Feature Request: Uniqueness Operator #37

Closed Lutzifer closed 8 years ago

Lutzifer commented 10 years ago

An operator, that removes double entries from the query results:

e.g. [ {e.name} | e <~ geonames, e.altnames =~ "Passau", unique(e.name) ]

julochrobak commented 10 years ago

I'd suggest to introduce a set operator which takes a list parameter and returns a set, i.e. removes duplicate entries. Here are some examples:

set([1,1,2,2,3,4]) == [1,2,3,4]

set([{i: 1, c: "A"}, {i: 1, c: "A"}, {i: 1, c: "a"}]) == [{i: 1, c: "A"}, {i: 1, c: "a"}]

set([ [1,2], [1,3], [1,2], [3,1] ]) == [ [1,2], [1,3], [3,1] ]