Reputation: 2693
If I have two arrays, for example,
local array1 = [0,6,12];
local array2 = std.range(10,15);
and I want an array [0,6,10,11,12,13,14,15]
(not concerned specifically about ordering of the elements, just don't want duplicates)
How can I perform this as a union operation that will work for any two arrays of numbers?
Upvotes: 1
Views: 969
Reputation: 487
JSonnet has the function std.setUnion
for this use-case. Your result can be found with:
local result = std.setUnion(array1, array2);
See the JSonnet Standard Library reference for more details.
Upvotes: 2