STRICTMAPPER
mapper
Wraps a mapper or a macro in such a way that MAP will only call it if the number of ticks in the window is in the specified range.
Since 2.1 STRICTMAPPER can also take a timespan definition by inputing negative numbers. Number of ticks and timespan can also be mixed to specify, for instance, more than 2 points but less than 5 seconds.
Prior to 2.8 STRICTMAPPER could only wrap a mapper, now it can also wrap a macro if this macro is expected to be used as a mapper.
STRICTMAPPER is available since version 1.0.0.
See also
Signatures
Examples
NEWGTS
1 10
<% NaN NaN NaN T ADDVALUE %>
FOR
[
SWAP
mapper.count
2 2 STRICTMAPPER
0 1 0
] MAP
// Compute for every tick but the last because the window size is only 1.
NEWGTS
1 10
<% m NaN NaN NaN T ADDVALUE %>
FOR
[
SWAP
mapper.count
// Be careful when a window goes from 1 m to 2 m, both included,
// its timespan is 1 m + 1, thus the `1 -` in the following
-1 m 1 - -1 m 1 - STRICTMAPPER
0 1 0
] MAP
// Compute for every tick but the last because the window timespan is only 1.
NEWGTS
1 s NaN NaN NaN '1' ADDVALUE
2 s NaN NaN NaN '2' ADDVALUE
4 s NaN NaN NaN '4' ADDVALUE
6 s NaN NaN NaN '6' ADDVALUE
7 s NaN NaN NaN '7' ADDVALUE
8 s NaN NaN NaN '8' ADDVALUE
[
SWAP
mapper.count
-1 s 1 - 2 STRICTMAPPER // At least 1s+1 but no more than 2 points
1 1 0
] MAP
NEWGTS
1 s NaN NaN NaN '1' ADDVALUE
2 s NaN NaN NaN '2' ADDVALUE
4 s NaN NaN NaN '4' ADDVALUE
6 s NaN NaN NaN '6' ADDVALUE
7 s NaN NaN NaN '7' ADDVALUE
8 s NaN NaN NaN '8' ADDVALUE
[
SWAP
mapper.count
1 3 STRICTMAPPER // Between 1 and 3 points
-2 s 1 - MINLONG STRICTMAPPER // and more than 2s+1
1 1 0
] MAP