Module("system/io/char",[Imports([ImportWildcard("system/io")]),Strategies([SDefNoArgs("read-text-file",Seq(Match(Var("file")),Seq(AM(BA(CallNoArgs(SVar("fopen")),NoAnnoList(Tuple([Var("file"),NoAnnoList(Str("\"r\""))]))),Var("stream")),Seq(CallNoArgs(SVar("read-text-from-stream")),Where(BA(CallNoArgs(SVar("fclose")),Var("stream"))))))),SDefNoArgs("read-text-from-stream",Seq(Match(Var("stream")),Seq(Rec("x",LChoice(Build(NoAnnoList(ListTail([App(CallNoArgs(SVar("fgetc")),Var("stream"))],App(CallNoArgs(SVar("x")),NoAnnoList(Tuple([])))))),Build(NoAnnoList(List([]))))),CallNoArgs(SVar("implode-string"))))),SDefNoArgs("read-text-line",Seq(Match(Var("stream")),Seq(Rec("x",LChoice(Build(NoAnnoList(ListTail([App(Seq(CallNoArgs(SVar("fgetc")),Not(CharCong("'\\n'"))),Var("stream"))],App(CallNoArgs(SVar("x")),NoAnnoList(Tuple([])))))),Build(NoAnnoList(List([]))))),CallNoArgs(SVar("implode-string")))))]),Strategies([RDef("filter-text-file",[DefaultVarDec("more"),DefaultVarDec("done")],Rule(NoAnnoList(Tuple([Var("filein"),Var("fileout")])),Var("fileout"),Seq(AM(BA(CallNoArgs(SVar("fopen")),NoAnnoList(Tuple([Var("filein"),NoAnnoList(Str("\"r\""))]))),Var("streamin")),Seq(AM(BA(CallNoArgs(SVar("fopen")),NoAnnoList(Tuple([Var("fileout"),NoAnnoList(Str("\"w\""))]))),Var("streamout")),Seq(Call(SVar("repeat"),[Seq(Call(SVar("for"),[Seq(Build(NoAnnoList(List([App(CallNoArgs(SVar("fgetc")),Var("streamin"))]))),CallNoArgs(SVar("more"))),CallNoArgs(SVar("done")),Seq(Build(NoAnnoList(ListTail([App(CallNoArgs(SVar("fgetc")),Var("streamin"))],RootApp(Id)))),CallNoArgs(SVar("more")))]),Call(SVar("reverse-map"),[BA(CallNoArgs(SVar("fputc")),NoAnnoList(Tuple([RootApp(Id),Var("streamout")])))]))]),Seq(BA(CallNoArgs(SVar("fclose")),Var("streamin")),BA(CallNoArgs(SVar("fclose")),Var("streamout"))))))))])])
