nickel
nickel copied to clipboard
Set data type
Is your feature request related to a problem? Please describe.
For collection types, Nickel supports: records, dictionary, arrays, but one common structure missing is Set
, an unordered collection like an array where all values must be unique. Uniqueness can prevent certain kinds of errors where the consumer should need to consider duplicate values, but also comes with a grab bag of handy combinators like union
, intersect
, difference
, merge
, etc.
Describe the solution you'd like
Add a new data type: Set T
+ stdlib
module std-set
Describe alternatives you've considered
Making a bunch of contracts around Array T
.
Additional context This is a common data structure in most languages. It’s been a long personal pain point with its absence in JSON, however alternatives like EDN do support it. Being able to assert a JSON Array as a Set would be very useful.