On 10/29/02 3:13 PM, Damian Conway wrote:
> I suspect it will be quite unusual to see nested superpositions
> in code. Most folks are going to be using them for simple but
> very common checks like:
> 
> [...]
>
> my $seen = $start | $finish;
> for <> -> $next {
> print $next unless $next == $seen;
> $seen |= $next;
> }

I just spent 2 minutes staring at that last example until I finally
understood it.  While I agree that there are many common uses for this
stuff, not all common uses are "simple", IMO.

I think my hang-up mostly had to do with all the existing "knowledge" I have
about how "|" and "|=", and even "==" are "supposed" to work.  Had the
example used the English versions of the operators, I would have gotten it
instantly:

my $seen = any($start, $finish);

for <> -> $next
{
  print $next  unless $next == $seen;
  $seen = any($seen, $next);
}

(Okay, maybe I would have gotten stuck for a moment on the "$next == $seen"
part, but that's about it :)

Anyway, I think this is just a long-winded way of expressing my support for
an article explaining set operators (or "cat-bunny slippers" or whatever :)
and all their wonderful uses.  And I also think the English versions of the
operators are much easier to understand, at least initially, if only due to
the  historical baggage of |, &, and friends.

-John

Reply via email to