develooper Front page | perl.perl6.language | Postings from July 2010

Re: Suggested magic for "a" .. "b"

Thread Previous | Thread Next
From:
Dave Whipp
Date:
July 28, 2010 15:49
Subject:
Re: Suggested magic for "a" .. "b"
Message ID:
20100728224919.26838.qmail@lists-nntp.develooper.com
Darren Duncan wrote:
> Dave Whipp wrote:
>> Similarly (0..1).Seq should most likely return Real numbers
> 
> No it shouldn't, because the endpoints are integers.
> 
> If you want Real numbers, then say "0.0 .. 1.0" instead.
> 
> -- Darren Duncan

That would be inconsistent. $x ~~ 0..1 means 0 <= $x <= 1. The fact that 
the endpoints are integers does not imply the the range does not include 
non-integer reals.

My argument is that iterating a range could be defined to give you a 
uniform distribution of values that would smart match true against that 
range -- and that such a definition would be just as reasonable as (and 
perhaps more general than) one that says that you get an incrementing 
ordered set of integers across that range.

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About