Sets in C (?) :idea from PASCAL

Michael Greim greim at sbsvax.UUCP
Thu Aug 18 02:31:07 AEST 1988


In article <8808121452.AA14152 at ucbvax.berkeley.edu> U23405 at UICVM.BITNET writes:
<In PASCAL, there is a datatype called SET that (obviously) deals with sets.
<What I would like to know is whether anyone has tried to implement this
<datatype in C (either by a system header file or by typedefs). Any comments
<would be helpful. (And I mean *ANY* comments)
In article <2732 at boulder.Colorado.EDU>, swarbric at tramp.Colorado.EDU (Frank Swarbrick) writes:
< Well, I have written three functions called inset(), setplus(), and setminus()
< which use arrays of any type as sets.  inset() tells you if something is in
< your set, setplus() adds something to your set, and setminus() takes something
< out.  It's not as good as Pascal's real sets, but it's OK.  I could send you
< them if you like.

I have a set of functions too. You can do all the usual set operations on
any data type which convertible to integer. This may not be what you
want, but if you are interested I can send you a copy. (First I will
have to improve the code, though :-)

	-mg
-- 
UUCP:  ...!uunet!unido!sbsvax!greim   | Michael T. Greim
       or greim at sbsvax.UUCP           | Universitaet des Saarlandes
CSNET: greim%sbsvax.uucp at Germany.CSnet| FB 10 - Informatik (Dept. of CS)
ARPA:  greim%sbsvax.uucp at uunet.UU.NET | Bau 36, Im Stadtwald 15
voice: +49 681 302 2434               | D-6600 Saarbruecken 11, West Germany

# include <disclaimers/std.h>



More information about the Comp.lang.c mailing list