Brandon mused:

> It occurs to me:  If their purpose is that narrow, why are they wasting
> conceptual space in the core language?

Well, mainly because their purpose isn't narrow at all: it's parallelized data
comparisons (all(@values) < $threshold), and multiway comparisons
(all(@values) ~~ any(@ranges)), and distributed sub calls on a
set of arguments (foo(any @alternatives), and subroutine call
parallelism (&foo & &bar)($arg), and type unions (my Wax|Polish $shimmer),
and type intersections (my $coefficient where Num & 0..1), and parallel
lookup of arrays and hashes ($name ~~ %known_aliases{any $suspect}),
and multiway existence checks (if any %f...@args} :exists), and
convenient multiple file tests ($fh ~~ :r & :w & :!x), and overlapping
or exhaustive matches (my $results = m:ex/foo/), and complex matching
logic expressed declaratively (my $is_valid = Num & {$_>0} | Str & /zero|one/).

And, of course, they're in the core because there's no point in having
that much power and usefulness if it's not fast too.


Reply via email to