Open ZackarySantana opened 9 months ago
Fair enough; seems sensible to have this.
FYI: our Set
API does have a difference
:
s1: Set<Int> = Set(1, 2, 3)
s2: Set<Int> = Set(2, 3, 4)
s3 = s1.difference(s2)
Feel free to submit a PR! Take a look at ListNodes.java for where our List methods are implemented.
You will also need to add tests here: https://github.com/apple/pkl/blob/main/pkl-core/src/test/files/LanguageSnippetTests/input/api/list.pkl.
Currently, I use this utility function to find the difference A - B
It would be a nice to have to be able to do A.difference(B) and have the same resulting list.
I read the contributing to implement this myself but I don't think there's enough docs to do so. I noticed that external (built-in) types (like lists) often have an external modifier for example, and in the docs it doesn't say how that links to anything.