19 lines
304 B
Plaintext
19 lines
304 B
Plaintext
|
ds={
|
||
|
"init":func(end){@end=end; @current=0; @prev=@current},
|
||
|
"current":func(){prev},
|
||
|
"next":func(){
|
||
|
(current <= end) ? [true] {@current=current+1; @prev=current} :: {nil}
|
||
|
},
|
||
|
"reset":func(){@current=0; @prev=@current}
|
||
|
}
|
||
|
|
||
|
// Example
|
||
|
//;
|
||
|
//it=$(ds,3);
|
||
|
//it++;
|
||
|
//it."reset"
|
||
|
//it++;
|
||
|
//it++;
|
||
|
//add(it)
|
||
|
|