Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

Re^5: [Raku] Ranges in array slices

by tomasz (Acolyte)
on Jun 05, 2021 at 20:46 UTC ( #11133566=note: print w/replies, xml ) Need Help??

in reply to Re^4: [Raku] Ranges in array slices
in thread [Raku] Ranges in array slices

To make sure, we're on the same page, the sequence of even numbers can end:
> say 0, * + 2 ... $_ for 2, 10 (0 2) (0 2 4 6 8 10)
And if this was obvious, then - yes, that's the point. Sequences allow this kind of dissonances. No error is reported by the language. There's space for absurd. Or what should this be better called?

Replies are listed 'Best First'.
Re^6: [Raku] Ranges in array slices
by holli (Abbot) on Jun 05, 2021 at 21:08 UTC
    I see no dissonance or absurdity here. The code creates two Sequences in a loop and they end because the end conditions (2 and 10) (the thing to the right of ....) get reached.
    If you create a sequence like 0, * + 2 ... 1 where the values go up and the end value is smaller than even the first calculated value, then that Seq. will can never end.


    You can lead your users to water, but alas, you cannot drown them.
Re^6: [Raku] Ranges in array slices
by LanX (Sage) on Jun 05, 2021 at 21:00 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11133566]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2022-10-05 22:49 GMT
Find Nodes?
    Voting Booth?
    My preferred way to holiday/vacation is:

    Results (25 votes). Check out past polls.