Jeremy Howard wrote:
>
> > @u = [..]; # @a contains the univeral set
> > works just fine, so I can then say:
> > @i = grep {$_=abs($_)} @u; # @i contains the integers
> > # See higher-order function and multi-way comparison RFCs
> > $s = sum (grep 0<__<=100 @i);
> > print "The sum of the 1st 100 integers is: $s";
> >
>
> Oops, a correction. [..] should mean 'the set of all integers'. _Not_ the
> univeral set. So my code snippet should be:
> @i = [..]; # @i contains the integers
> $s = sum (grep 0<__<=100 @i);
> print "The sum of the 1st 100 integers is: $s";
>
> I still think it would be cool to be able to specify other infinite sets
> somehow (with rationals, with complex, etc) but [..] isn't the right way.
> Sorry about that.
If we're going to do THAT, why not predeclare functions (or static
lists) of different mathematical terms, like the set of all real
numbers, the set of all natural numbers, the set of integers, etc.? No
sense in mangling the .. operator (not to mention the anonymous array
reference) to suit a specific purpose like that.
--
Mike Pastore
[EMAIL PROTECTED]