[erlang-questions] working with sets

Michael McDaniel <>
Fri Jan 4 00:04:26 CET 2008


 Seems like the sets module could help out.  Check if 
 sets:is_element/2 and sets:add_element/2 as needed
 (following is untested)

 case sets:is_element(Element, Set) of
	false -> sets:add_element(Element, Set) ;
	true  -> nop
 end


~M

On Thu, Jan 03, 2008 at 05:08:49PM -0500, Vance Shipley wrote:
> Can one of you CS wizzes point me at the best way to
> maintain a set of sets where all elements of all sets
> must be unique?  I don't need a really big data set
> but rolling my own with the list module feels wrong.
> 
> For example {{1,2,3},{4,5,6},{7,8,9}} is a valid set.
> Trying to enter {9,10,11} should fail.
> 
> 	-Vance
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions

-- 
Michael McDaniel
Portland, Oregon, USA
http://autosys.us
+1 503 283 5284



More information about the erlang-questions mailing list