Re: Range Expressions

> My inclination now is to drop "by" as an operator keyword, and instead to have a function slice(seq, X, Y, Z) which behaves like seq[X:Y:Z] in Python and Javascript, subject to variations in edge cases (I think Python and Javascript differ only the handling of step=0). X, Y, and Z can all be defaulted.
>
> This doesn't leave you with a simple way of expressing a sequence of integers such as (10 by 2 to 20) ; but most of the time when you want this, it's because you're going to use those integers for indexing some other sequence. If you really want it you can write slice(10 to 20, (), (), 2); or if we allow keyword arguments, slice(10 to 20, step: 2).

Yes, I think most people can live with that.
And if you want to stick with the existing syntax,
you can write "reverse(1 to 10)" or "(5 to 10) ! (. * 2)".

Received on Monday, 7 December 2020 15:28:28 UTC