Re: Range Expressions

From

http://rigaux.org/language-study/syntax-across-languages.html#CntrFlowLoop

both "by" and "step" are used in multiple languages. Visual Basic and Ruby use "step"; Smalltalk, Maple, Common Lisp, Rexx, and CoffeeScript use "by".

Not a big deal, either would work.

Michael Kay
Saxonica

> On 30 Nov 2020, at 14:07, Dave Pawson <dave.pawson@gmail.com> wrote:
> 
> 1 to 10 step 2 (may be) more common / familiar?
> 
> regards
> 
> On Mon, 30 Nov 2020 at 14:05, Michael Kay <mike@saxonica.com> wrote:
>> 
>> Someone, I forget who, gave feedback suggesting making "by" a binary operator so
>> 
>> 1 to 10 by 2 means ((1 to 10) by 2) i.e. 1, 3, 5, 7, 9
>> 1 to 10 by -1 gives 10, 9, 8, 7, 6, 5, 4, 3, 2, 1
>> ("A", "B", "C", "D") by 2 gives ("A", "C")
>> ("A", "B", "C", "D") by -2 gives ("D", "B")
>> 
>> I've adopted this suggestion in my latest draft.
>> 
>> Michael Kay
>> Saxonica
> 
> 
> 
> -- 
> Dave Pawson
> XSLT XSL-FO FAQ.
> Docbook FAQ.

Received on Monday, 30 November 2020 15:08:43 UTC