Re: Union of sets (lists
Re: Union of sets (lists
- Subject: Re: Union of sets (lists
- From: Axel Luttgens <email@hidden>
- Date: Mon, 13 Jan 2003 11:51:25 +0100
Gary Lists wrote:
>
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.
Hmm... if you want to represent the contents of both packs by sets of
strings, you need a one-to-one mapping between the set of real objects
and the set of possible strings.
That is, you should have written something like this:
Set Q has elements {apple1, apple2, pencil, orange, frog}
Set X has elements {apple3, rubberband, penny, banana}
because the apple present in kid X's bag can't be present in kid's Q bag
("this apple isn't that apple"), and because if one counts two apples in
kid's Q bag, they are different ones too.
Now, you could argue that your initial representation was indeed
correct: after all, the string "apple" appearing first in set Q's
representation is not the string "apple" appearing at the second place
in set Q's representation, nor it is the string "apple" appearing first
in set's X representation.
That's correct as long as you speak about THAT piece of paper upon which
you have written THAT two-dimensional representation of the contents of
bags Q and X.
As soon as you start with another sheet of paper, you would need a
one-to-one mapping between your first representation and the second one
(based on a system of coordinates, for example).
>
>
>
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.
Hmm...
Sets are by definition unordered, while AppleScript's list are ordered
things.
AppleScript's records would be closer to the concept of set.
>
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]
This ("the 3rd a from A") is typically the kind of mapping I was
speaking about.
>
>
>
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
Hmmm...
Never mind, just some kind of off-topic considerations ;-)
Axel
_______________________________________________
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.