Eric Roode <[EMAIL PROTECTED]> writes:
[...]
> The underlying problem is that arrays don't make SENSE as an
> implementation for sets. What is the value of:
>
> (1, 2, 3, 1, 2, 3) union (2, 3, 4, 5) ?
>
> is it (1, 2, 3, 4, 5)? is it (1, 2, 3, 1, 2, 3, 4, 5)?
But all of the following DO make sense as implementations for sets,
depending on your application:
* Sorted lists
* Lists with guaranteed unique elements
* Lists (as implementations for multisets, with you favourite
definitions of the operations)
* Hashes
* Bit vectors
* Integers
* Trees
* Balanced trees
[...]
> IF new keywords "union" and "intersection" (and perhaps others)
> are to be added to the language, they should be functions that
> operate on the KEYS of HASHES, not on arrays!
Now s/HASHES/SORTED LISTS/ on the above, followed by the other 6. I
assure you that readers of the list have used all 8 (and likely
others).
> And, imho, these are special-purpose functions that are going to be
> extremely useful to a fairly small set of users (math folks), and
> are going to be somewhat useful to another small set of people,
> and fairly useless to the majority of Perl programmers. That screams
> "module" to me, not "new core features".
They're going to be useful to a tiny minority of users: math folks
whose application matches the use of a hash-based implementation.
(Actually, all uses I've seen of set datatypes were strictly outside
mathematics, but that doesn't alter your argument or mine). The
problem is that the desired semantics (in the sense, e.g., of
worst-case, average-case, and "my-case" complexity) of the "set"
datatype vary greatly with application.
When I started reading this thread, I was *sure* it would be
immediately clear that sets are bit vectors, drawn on some
pre-specified world!
--
Ariel Scolnicov |"GCAAGAATTGAACTGTAG" | [EMAIL PROTECTED]
Compugen Ltd. |Tel: +972-2-5713025 (Jerusalem) \ We recycle all our Hz
72 Pinhas Rosen St. |Tel: +972-3-7658514 (Main office)`---------------------
Tel-Aviv 69512, ISRAEL |Fax: +972-3-7658555 http://3w.compugen.co.il/~ariels