Dave Whipp wrote:
>An Int is Enumerable: each value that is an Int has well defined succ
>and pred values. Conversely, a Real does not -- and so arguably should
>not support the ++ and -- operators. Amonst other differences, a
>Range[Real] is an infinite set, whereas a Range[Int] has a finite
>cardinality.

I think that Dave has a point about a Range[Real] being an infinite
set: According to DWIM, if I see "4.5..5.7", I don't think of "4.5,
5.5"; I think of "numbers greater than or equal to 4.5 but less than
or equal to 5.7".  Likewise, "4.5^..^5.3" contains "numbers greater
than 4.5 but less than 5.3", not "an empty list".

Mind you, I generally wouldn't be using such a range for iterative
purposes; rather, I'd be using it as a matching alternative to
comparison operators:

  C<when 4.5..5.7 {...}> === C<< if 4.5 <= $_ <= 5.7 {...; break} >>
  C<when 4.5^..^5.3 {...}> === C<< if 4.5 < $_ < 5.3 {...; break} >>
  C<when 1.2... {...}> === C<< if 1.2 <= $_ {...; break} >>
  C<when ...^7.6 {...}> === C<< if $_ < 7.6 {...; break} >>
  C<when ...^4.5 | 5.7^... {...}> === C<< if $_ < 4.5 || 5.7 < $_
{...; break} >> === C<when not 4.5..5.7 {...}>

That said: if I _did_ use it for iterative purposes, I'd rather get
the current approach of turning it into a step-by-one incremental list
than have perl 6 complain about trying to iterate over an infinite
set.  Well, unless I said something like "loop ...4.3 {...}"; in that
case, I'd expect Perl to complain about not knowing where to start.

--
Jonathan "Dataweaver" Lang

Reply via email to