Expression needed for "Arithmetic Progression"
Describe the feature
Expression needed for "Arithmetic Progression". Need a shorthand for defining a list that has a pattern. I am currently frustrated that we don't currently allow for this expression.
<progression-list> ::= 'progression''('<start>,<end>[','<stepsize>]')'
... results in a list ==> [start, start+stepsize, ...stop]
example1:
progression(5, 100, 5)
[5...100; 5]
[5, 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100]
example2:
progression(0.5, 10, 0.5)
[0.5...10; 0.5]
[0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5, 6.0, 6.5, 7.0, 7.5, 8.0, 8.5, 9.0, 9.5, 10.0]
this is different from range:
range(5, 100)
[5..100]
[all_values(5 to 100)]
progression() returns a list comprising all step values within a progression bounded by a start value 'start' and end value 'end', where the difference 'stepsize' between any two consecutive values is constant; i.e. an arithmetic progression.
If the progression() does not specify a stepsize, a stepsize of 1 is assumed.
To create progressions with decreasing integer values, use a negative value stepsize. The progression is inclusive for a non-empty progression, and the arithmetic progression will therefore always contain start and — depending on the values of: (start, stepsize and end) — end. The only exception is where the progression does not contain start; these are an empty progression. An empty progression will be returned with an error if the value stepsize is negative and start to end is positive, or vice-versa, e.g. progression(1, 10, -1).
Describe the solution you would like
example:
progression(5, 100, 5)
[5...100; 5]
Proposal 1
<range> ::= 'range''('<min>','<max>')' | '['<min>'..'<max>']'
<progression> ::= 'range''('<min>','<max>','<stepsize>')' | '['<min>'..'<max>';' <stepsize>']'
Note: This is the first use of ';'.
example:
range(5, 100, 5)
[5..100; 5]
Proposal 2
<range> ::= 'range''('<min>','<max>')' | '['<min>'..'<max>']'
<progression> ::= 'progression''('<min>','<max>','<stepsize>')' | '['<min>'..'<max>';' <stepsize>']'
Note: This is the first use of ';'.
example:
progression(5, 100, 5)
[5..100; 5]
Describe alternatives you have considered
range(5,100,5)
[5..100;5]
[5,10,15,20,25,30,35,40,45,50,55,60,65,70,75,80,85,90,95,100]
Describe the backwards compatibility
Additional context
LINKED TO:
https://code.asam.net/simulation/standard/openscenario-2.0/-/issues/242