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,
:-)
In article <·················@cisco.com>, username <········@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, ······@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.
* username <········@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.
///