^ note: ^3 means the integer "just before" 3  (zero is presume to be the
    start point)

               3^ means the integer "just after" 3  (an ending point is
    required)



On 12/31/20 10:15 PM, Kevin Pye wrote:
No, it does not. Go back and read what Brad wrote; he was quite explicit.

Nothing about the range 0 ..^ 3 (for which "^3" is just a short-cut) says anything about integers. It is the range of numbers (real numbers if you like) ranging from 0 to 3, but excluding 3. In standard mathematical notation that would be "[0,3)". If you iterate over the range then you start with the beginning of the range and keep adding one until you reach the end (in this case ignoring the final value if it is equal to the end-point).

If the range were 0.5 .. 3 then the iterated values would be 0.5, 1.5 and 2.5.


Hi Kevin,

My notes were for "for" loops.

   > for ^2 {print "$_\n";}
   0
   1


I am not able to reproduce your comments:

   > for ^2.1..2.5 {print "$_\n";}
   Range objects are not valid endpoints for Ranges
     in block <unit> at <unknown file> line 1

   > for ^2.1 .. 2.5 {print "$_\n";}
   Range objects are not valid endpoints for Ranges
     in block <unit> at <unknown file> line 1

Would you mind throwing me an REPL example?

Many thanks,
-T


Reply via email to