Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

sets operations

6 views
Skip to first unread message

username

unread,
Sep 6, 2001, 12:51:54 PM9/6/01
to
Hi Dear all,

I'd like to use Lisp language to implemet following operations on Set.

- Set Union
- Set Difference
- Set Interaction

Detailed requirement like this:

Set Union, Set Difference, And Set Intersection.
Implement these three operations on
sets. You should be able to handle two sets as input at a minimum,
ideally any number of sets. If you need to look up these set
operations in a discrete math book, then do that. The input
representation and output representation is up to you. However, the
results should not contain duplicates (e.g., if set X = (1 2 3) and
set Y = (2 3 4) then X + Y (X UNION Y) = (1 2 3 4) NOT (1 2 2 3 3 4)
and so on).

Example: (and this is ONLY NOTIONAL - An IDEA not a specification)

INPUT FILE
----------
SET A = {a b c d e}
SET B = {x y z a}
* <--- meaning INTERSECTION
---------
Your program should perform set intersection and print out 'a'.

I heard it should be easy by using Lisp.

Any suggestions on that?

Thanks,
:-)


Barry Margolin

unread,
Sep 6, 2001, 12:58:41 PM9/6/01
to
In article <3B97A9AA...@cisco.com>, username <user...@cisco.com> wrote:
>I heard it should be easy by using Lisp.

Common Lisp has built-in functions REMOVE-DUPLICATES, UNION, INTERSECTION,
and SET-DIFFERENCE. I'm guessing your teacher doesn't want you to use
these, though.

>Any suggestions on that?

Do your own homework.

--
Barry Margolin, bar...@genuity.net
Genuity, Woburn, MA
*** DON'T SEND TECHNICAL QUESTIONS DIRECTLY TO ME, post them to newsgroups.
Please DON'T copy followups to me -- I'll assume it wasn't posted to the group.

Erik Naggum

unread,
Sep 6, 2001, 1:53:38 PM9/6/01
to
* username <user...@cisco.com>

> Set Union, Set Difference, And Set Intersection.

Do union, intersection and set-difference fulflll your needs?
These are standard functions in Common Lisp.

///

0 new messages