2024-05-03 08:48:29 +02:00
|
|
|
builtin ["os.file", "base"];
|
|
|
|
|
|
|
|
readInt=func(fh){
|
2024-06-17 14:07:39 +02:00
|
|
|
line=fileReadText(fh);
|
2024-05-03 08:48:29 +02:00
|
|
|
line ? [nil] {nil} :: {int(line)}
|
|
|
|
};
|
|
|
|
|
|
|
|
ds={
|
|
|
|
"init":func(filename){
|
2024-06-09 16:01:47 +02:00
|
|
|
fh=fileOpen(filename);
|
2024-06-17 14:07:39 +02:00
|
|
|
fh ? [nil] {nil} :: { @current=readInt(fh) };
|
2024-05-03 08:48:29 +02:00
|
|
|
fh
|
|
|
|
},
|
|
|
|
"current":func(){
|
2024-06-17 14:07:39 +02:00
|
|
|
current
|
2024-05-03 08:48:29 +02:00
|
|
|
},
|
|
|
|
"next":func(fh){
|
2024-06-17 14:07:39 +02:00
|
|
|
@current=readInt(fh);
|
|
|
|
current
|
2024-05-03 08:48:29 +02:00
|
|
|
},
|
|
|
|
"clean":func(fh){
|
2024-06-09 16:01:47 +02:00
|
|
|
fileClose(fh)
|
2024-05-03 08:48:29 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
//;f=$(ds, "int.list")
|
2024-06-17 14:07:39 +02:00
|
|
|
|
|
|
|
//;f++
|
|
|
|
//;f++
|
|
|
|
//;f++
|
|
|
|
//*/
|
2024-05-03 08:48:29 +02:00
|
|
|
//;add(f)
|