[erlang-questions] working with sets

Robert Virding rvirding@REDACTED
Fri Jan 4 01:21:51 CET 2008


I would use ordsets to test with as it is then easy to actually see and
understand the sets. Understanding a set from sets is not always trivial.
The interface is the same and if the sets are small then maybe it is
perfectly alright to use ordsets anyway.

Robert

On 04/01/2008, Michael McDaniel <erlangy@REDACTED> wrote:
>
> umm, the false should be ...
>
> false -> NewSet = sets:add_element(Element, Set) ;
>
> ~M
>
> On Thu, Jan 03, 2008 at 03:04:26PM -0800, Michael McDaniel wrote:
> >
> >  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
> > > erlang-questions@REDACTED
> > > http://www.erlang.org/mailman/listinfo/erlang-questions
> >
> > --
> > Michael McDaniel
> > Portland, Oregon, USA
> > http://autosys.us
> > +1 503 283 5284
>
> --
> Michael McDaniel
> Portland, Oregon, USA
> http://autosys.us
> +1 503 283 5284
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080104/25e1ca32/attachment.htm>


More information about the erlang-questions mailing list