On Sun, Sep 20, 2009 at 01:29:22AM -0400, Aaron Sherman wrote:
: On Sat, Sep 19, 2009 at 9:45 PM, David Green <david.gr...@telus.net> wrote:
: 
: > On 2009-Sep-19, at 5:53 am, Solomon Foster wrote:
: >
: >  The one thing that worries me about this is how :by fits into it all.
: >>        rakudo: given 1.5 { when 1..2 { say 'between one and two' }; say
: >> 'not'; };
: >>        rakudo: given 1.5 { when Range.new(from => 1, to => 2, by => 1/3) {
: >> makes me very leery.  I know :by isn't actually implemented yet, but what
: >> should it do here when it is?
: >>
: >
: > Exactly: 1.5 is "between" 1 and 2, but if you're counting by thirds, 1.5 is
: > not in the list(1..2 :by(1/3)).  Sure, we can stipulate that this is simply
: > how the rules work, but people are still going to get confused.  On the
: > other hand, we can get rid of the list/series/:by part of Ranges without
: > losing any power (move that capability to ... instead), and cut down on the
: > confusion.
: 
: 
: 1..2 is used abstractly to indicate a range, even though it's actually an
: iterator that will return two values. However, once you apply an explicit
: :by, I think you've gone past that abstraction, and it's no longer
: reasonable to expect that values that fall between your iterations will
: match.

Yes, I think it's fair to say that either list context OR a :by turns
a Range into a RangeIterator that matches like a list.  Hence, this
ought to match:

    (1,3,5) ~~ (1..5 :2by)

Larry

Reply via email to