Next: loops generators port, Previous: loops generators typed, Up: loops generators [Index]

- Generator Syntax:
**:range**`vars``stop` - Generator Syntax:
**:range**`vars``start``stop` - Generator Syntax:
**:range**`vars``start``stop``step` Runs through a range of exact rational numbers.

`(:range`

`vars``stop`)Evaluate the expression

`stop`, which must result in an exact integer*N*, and runs through the finite sequence*0, 1, 2, …, N-1*. If*N*is zero or negative the sequence is empty.`(:range`

`vars``start``stop`)Evaluate the expressions

`start`and`stop`, which must result in exact integers*A*and*B*, and runs through the finite sequence*A, A+1, A+2, …, B-1*. If*B*is less or equal*A*then the sequence is empty.`(:range`

`vars``start``stop``step`)First evaluates the expressions

`start`,`stop`and`step`, which must result in exact integers*A*,*B*and*S*such that*S*is non–zero. Then the sequence*A, A+S, A+2*S, …, A+(N-1)*S*is enumerated where:*N = ceil((B-A)/S)*.In other words, the sequence starts at

*A*, increments by*S*, and stops when the next value would reach or cross*B*. If*N*is zero or negative the sequence is empty.

- Generator Syntax:
**:real-range**`vars``stop` - Generator Syntax:
**:real-range**`vars``start``stop` - Generator Syntax:
**:real-range**`vars``start``stop``step` Runs through a range of real numbers using an explicit index variable. This form of range enumeration avoids accumulation of rounding errors and is the one to use if any of the numbers defining the range is inexact, not an integer, or a bignum of large magnitude.

Providing default values

*0*for`start`and*1*for`step`, the generator first evaluates`start`,`stop`and`step`, which must result in reals*A*,*B*and*S*such that*N = (B-A)/S*is also representable as a real. Then the sequence*0, 1, 2, …, N-1*is enumerated while the current value*I*is less than*N*, and the variable in`vars`is bound to the value*A+I*S*. If any of the values*A*,*B*or*S*is non–exact then all values in the sequence are non–exact.

- Generator Syntax:
**:char-range**`vars``min``max` Run through a range of characters. First

`min`and`max`are evaluated, which must result in two characters*A*and*B*. Then the sequence of characters*A, A+1, A+2, …, B*is enumerated in the order defined by`char<=?`

. If*B*is smaller than*A*then the sequence is empty. Note that*B*is included in the sequence.

Next: loops generators port, Previous: loops generators typed, Up: loops generators [Index]