util.set: Add set.xor() to get a set consisting of items not in both sets

Wed, 22 Apr 2009 18:03:42 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Wed, 22 Apr 2009 18:03:42 +0100
changeset 1030
a82268d507fc
parent 1029
4ead03974759
child 1031
ec013f93de81

util.set: Add set.xor() to get a set consisting of items not in both sets

util/set.lua file | annotate | diff | comparison | revisions
--- a/util/set.lua	Wed Apr 22 18:03:02 2009 +0100
+++ b/util/set.lua	Wed Apr 22 18:03:42 2009 +0100
@@ -141,4 +141,8 @@
 	return set;
 end
 
+function xor(set1, set2)
+	return union(set1, set2) - intersection(set1, set2);
+end
+
 return _M;

mercurial