David Gamey wrote:
> Folks,
> 
> I noticed the following odd behavior:
> 
> Explicit: 0 to 15 by (2 to 5) : 0 2 4 6 8 10 12 14 0 3 6 9 12 15 0 4 8 
> 12 0 5 10  15
> Implicit: 0 to 15 by 2 to 5    : 0 1 2 3 4 5 2 3 4 5 4 5
> 
> The explicit example works as expected.  Implicit - not so much.

Hmmm, without the parens, you get (because to-by is a tertiary
operator and it's left associative) the association as if the
parens were:

    (0 to 15 by 2) to 5

which evaluates as:

     0 to 5: 1 2 3 4 5
     2 to 5: 2 3 4 5
     4 to 5: 4 5
     6 to 5: fail
     8 to 5: fail
     ...
    14 to 5: fail

which matches the output shown above.  While it's not really obvious
it is consistent.

-- 
Steve Wampler -- [email protected]
The gods that smiled on your birth are now laughing out loud.

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Unicon-group mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/unicon-group

Reply via email to