util.set: Add set.xor() to get a set consisting of items not in both sets
authorMatthew Wild <mwild1@gmail.com>
Wed, 22 Apr 2009 17:03:42 +0000 (18:03 +0100)
committerMatthew Wild <mwild1@gmail.com>
Wed, 22 Apr 2009 17:03:42 +0000 (18:03 +0100)
util/set.lua

index bb318adf5290a207d41c3c7f0a2144acf4dd2dcd..84bfe8c42c299e29bcb506ab153198b5677f91b0 100644 (file)
@@ -141,4 +141,8 @@ function intersection(set1, set2)
        return set;
 end
 
+function xor(set1, set2)
+       return union(set1, set2) - intersection(set1, set2);
+end
+
 return _M;