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

I think we all agree here on what's what and there's no point to argue about. I'll however continue my line of thinking just as a lighthearted musing.

It's a language feature and so if there is an error, it will be a semantic error. Or possibly not, as this feature can be productively exploited.

For example, let's take a hard to calculate number N and use it as the last element condition. And for the generator function let's use a G, and some S for the starting point. Here' the formula:
S, G ... N
So we're testing N against G for S. As the test duration can explode towards infinity, we need to limit the number of steps or the time of our test. Let's name this limitation "<<< L" in pseudocode:
S, G ... N <<< L
If the test doesn't end before L, we could consider this a proof of absurdity (or semantic errorness) of "S, G ... N" relative to L. And isn't this absurdity similar to infinity of N? Couldn't we say N is infinite relative to S, G, L?

EDIT: This would be valid for easily computable Ns also. We could say: 1 is infinite relative to 0, * + 2, any L.

Replies are listed 'Best First'.
Re^6: [Raku] Ranges in array slices
by holli (Abbot) on Jun 06, 2021 at 18:56 UTC
    If that is absurd then

    while N <<< L: G = G of S

    is absurd too. The right hand side of ... is just a condition, nothing more. If you're saying that things get absurd when the condition is so expensive that it dwarfs the loop body, then yeah. But then your code is bad, not the semantics of the language.

    I might be still be missing the point, though.


    You can lead your users to water, but alas, you cannot drown them.
      I never meant the semantics of the language itself. Only of the code. I mentioned its syntax though. And yes - bad code, that's it. What is absurd anyways if not a distortion, an error?