develooper Front page | perl.perl6.language | Postings from February 2005

Re: Sets vs Junctions

Thread Previous | Thread Next
From:
Michele Dondi
Date:
February 21, 2005 06:07
Subject:
Re: Sets vs Junctions
Message ID:
Pine.LNX.4.61.0502141153570.21746@wrussian.pcteor1.mi.infn.it
On Sun, 13 Feb 2005, Jonathan Lang wrote:

>>    If we want Sets in Perl, we should have proper Sets.
>
> I'll agree, depending on what you mean by "proper".  I'd be interested in
> having some means to perform set operations in perl6: unions,
> intersections, differences, membership checks, and subset/superset checks.

Well, one point to look at the issue is that the keys of a hash alread are 
a set. In some sense you get sets with an additional unavoidable feature 
(the values).

Talking Perl6, which has a type system, it becomes suddenly possible to 
have hashes of whatever type of values one may want. For example one may 
implement a good approximation to a set with an hash of 1-bit integers; I 
don't know if there will be a built in one-value-only data type, and I 
wouldn't see for it any other use than this.

OTOH the set of subsets of a given set A can be put in bijective 
correspondence with  {0,1}^A, in which case using 1-bit integers may have 
some sense from this perspective.

Again, using arbitrary integers (also in Perl5) you automatically have 
multisets, i.e. unordered lists.

In any case I, for one, would like "real" sets as builtin data types. I 
understand that some features of them are already provided by other data 
types and I find junctions to be of an extreme interest. It would be nice 
thus, if all these data types could be "linked" is some elegant way. E.g. 
there should be an immediate, and possibly automatic way to turn a set 
(whatever it would) be into a junction or a hash (with certain 
predefined values) where needed.

As a last observation, hashes, which are from the UI POV the counterpart 
of mathematical functions, could be based on (the counterpart of 
mathematical) sets, whereas they're being based on a somewhat "orthogonal" 
concept, i.e. that of ordered pairs. Of course this approach is 
interesting too, but it would be nice to have both...

> Mind you, I _like_ Junctions, and I'd rather not toss them out in order
> to make room for Sets.  I'd rather have both if possible.

Me too!


Michele
-- 
>A question out of curiousity: who is this Green of Green's functions?
>Is he the same person of Green's theorem? :)
Yes. He was also an early environmentalist; hence the current
phrases "green" this and "green" that...
- David C. Ullrich in sci.math, thread "Who is Green?"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About