##- # Author: Brian Tiffin # Dedicated to the public domain # # Date: August 2016 # Modified: 2016-11-22/15:15-0500 ##+ # # set-operations.icn, some simple Set data examples # link fullimag procedure main() S1 := set("a", "b", "c", "c", "d") S2 := set("d", "e", "f", "g", "h") # sets have a uniqueness propery, "c" is only held once write("Uniqueness") write(fullimage(S1)) write(fullimage(S2)) # Union write("\nUnion S1 ++ S2") write(fullimage(S1 ++ S2)) # Intersection write("\nIntersection S1 ** S2") write(fullimage(S1 ** S2)) # Difference write("\nDifference S1 -- S2") write(fullimage(S1 -- S2)) write("Difference S2 -- S1") write(fullimage(S2 -- S1)) # Membership if member(S1 ** S2, "d") then write("\nd is in both sets") # Insertion write("\nInsertion") write(fullimage(insert(S1, "i"))) end