Article View: comp.lang.pascal.borland
Article #751Re: Pascal Sets
From: Bob Schor
Date: Sun, 23 Nov 1997 00:00
Date: Sun, 23 Nov 1997 00:00
29 lines
1681 bytes
1681 bytes
Joel Quevedo wrote:
> I was recently asked if I could create an Abstract Data Type that could take
> the place of a Pascal Set. I don't quite understand the question. Could
> anyone help me make sense of this?
I'm guessing here, but I think what is required is something that has the
properties
of a set. For example, you need to be able to test if X is an element of the
set
(equivalent to "x IN setofx"), add elements to the set, and to implement the set
operations of intersection, union, and difference.
If you can create a type "mysettype" that mimics the set, you only need to
write code
for the requisite functions and procedures.
FUNCTION isamemberof (x : elementtype; setofx : mysettype) : boolean;
PROCEDURE union (set1, set2 : mysettype; VAR set3 : mysettype);
etc. It won't look at "pretty" as the Pascal set implementation, but it should
work.
Bob Schor
Pascal Enthusiast
Technical Details
Message-ID:
<34789AA9.762E4C81@vms.cis.pitt.edu>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<657ss2$pbd$1@news.emi.net>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10a726,27ffeea6ce0d93ff,start X-Google-Attributes: gid10a726,public X-Google-Thread: 111659,27ffeea6ce0d93ff,start X-Google-Attributes: gid111659,public X-Google-Thread: 10c470,27ffeea6ce0d93ff,start X-Google-Attributes: gid10c470,public X-Google-Thread: 1006de,27ffeea6ce0d93ff,start X-Google-Attributes: gid1006de,public From: Bob Schor <bschor@vms.cis.pitt.edu> Subject: Re: Pascal Sets Date: 1997/11/23 Message-ID: <34789AA9.762E4C81@vms.cis.pitt.edu> X-Deja-AN: 291918340 References: <657ss2$pbd$1@news.emi.net> Organization: University of Pittsburgh Newsgroups: comp.lang.pascal.borland,de.comp.lang.pascal.misc,fr.comp.lang.pascal,it.comp.lang.pascal