Re: Union of sets (lists
Re: Union of sets (lists
- Subject: Re: Union of sets (lists
- From: Gary Lists <email@hidden>
- Date: Sun, 12 Jan 2003 14:51:51 -0500
On or about 1/12/03 11:34 AM, Michelle Steiner wrote:
>
If I recall set theory correctly (and it's been some 40+ years since I
>
studied it), sets contain only unique items, so there wouldn't be any
>
duplicates.
Nope...sets have "elements" which can be anything...duplicates are quite
allowed.
Imagine two kids' backpacks:
Set Q has elements {apple, apple, pencil, orange, frog}
Set X has elements {apple, rubberband, penny, banana}
Both valid sets.
So "union" them [put them all in one backpack] to get:
Set Z has elements {apple, apple, apple, pencil, orange, rubberband, banana,
frog}
AppleScript lists are sets, BTW. In fact, the { } used in set notation
means "whole elements are"...
Set A's elements = {a, b, a, c, a}
Set B's elements = {1, c, e, a, a}
Union = {a, b, a, c, a, 1, c, e, a, a} <-- pure union
Union = {a, b, c, e, 1} <-- unique union
iNtersection = {a, c} <-- pure intersection
{a, 1, c, a, a} <-- intersection [note absence of the 3rd a from A]
But, the OP would only know which level of 'purity' her/his solution was
requiring.
According to Venn, the 'pure' versions are most correct.
--
Gary
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.