On Wed, 30 Oct 2002, Dave Storrs wrote:
: In the "Re: Wh<[ie]>ther Infix Superposition ops" thread
:
: On Wed, 30 Oct 2002, Piers Cawley wrote:
:
: > But given a decent Collection hierarchy:
: >
: > my $seen = Set.new($start,$finish);
: >
: > for <> -> $next {
: > print $next unless $next =~ $seen;
: > $seen.insert($next);
: > }
:
: Just a thought...are sets (or other Collection types) something that we
: use often enough that they would deserve to be in the core language? I
: know I've used hashes as no-repeats-allowed sets many times, so clearly
: they are commonly useful. On the other hand, since this can be done,
: maybe there is no need to implement a new core feature for them.
:
: I suspect the answer is "no, we don't need them" but I just thought I'd
: ask; I'm curious about the design reasons either way.
The set features are a side effect of junctions, just as they're a side
effect of hashes. An "any" junction might well be implemented underneath
as a hash without values.
Possibly we might even extend the notion of hash to any "junk".
%hash = 1 | 2 | 3;
Then it's clearer that something junctional is going on when you say:
if $val ~~ %hash
I could see % becoming the sigil of choice for junks just for the
documentational value.
Larry