builtin ["os.file", "base"];

readInt=func(fh){
	line=fileReadText(fh);
	line ? [nil] {nil} :: {int(line)}
};

ds={
	"init":func(filename){
		fh=fileOpen(filename);
		fh ? [nil] {nil} :: { @current=readInt(fh) };
		fh
	},
	"current":func(){
		current
	},
	"next":func(fh){
		@current=readInt(fh);
		current
	},
	"clean":func(fh){
		fileClose(fh)
	}
}

//;f=$(ds, "int.list")

//;f++
//;f++
//;f++
//*/
//;add(f)
