-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set data type #1735
Comments
I wonder, do you want a builtin type |
Sets are also basic blocks for building more advanced compound types too |
Weighing in here as someone who also encountered use cases for |
Agreed that a I had fun with the encoding below, which has the advantage of playing nicely with the merge system (because
|
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 likeunion
,intersect
,difference
,merge
, etc.Describe the solution you'd like
Add a new data type:
Set T
+stdlib
modulestd-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.
The text was updated successfully, but these errors were encountered: