Module("collection/list/filter",[Imports([ImportWildcard("collection/list")]),Strategies([SDef("filter",[DefaultVarDec("s")],Choice(ListCongNoTail([]),LChoice(ListCong([CallNoArgs(SVar("s"))],Call(SVar("filter"),[CallNoArgs(SVar("s"))])),Match(NoAnnoList(ListTail([Wld],RootApp(Call(SVar("filter"),[CallNoArgs(SVar("s"))])))))))),SDef("filter",[DefaultVarDec("s"),DefaultVarDec("tail")],LChoice(Seq(Match(NoAnnoList(List([]))),CallNoArgs(SVar("tail"))),LChoice(ListCong([CallNoArgs(SVar("s"))],Call(SVar("filter"),[CallNoArgs(SVar("s")),CallNoArgs(SVar("tail"))])),Match(NoAnnoList(ListTail([Wld],RootApp(Call(SVar("filter"),[CallNoArgs(SVar("s")),CallNoArgs(SVar("tail"))]))))))))]),Strategies([SDef("retain-all",[DefaultVarDec("s")],Call(SVar("filter"),[CallNoArgs(SVar("s"))])),SDef("remove-all",[DefaultVarDec("s")],Call(SVar("filter"),[Not(CallNoArgs(SVar("s")))]))]),Strategies([SDef("reverse-filter",[DefaultVarDec("s")],Choice(ListCongNoTail([]),Seq(ListCong([Id],Call(SVar("reverse-filter"),[CallNoArgs(SVar("s"))])),LChoice(ListCong([CallNoArgs(SVar("s"))],Id),Match(NoAnnoList(ListTail([Wld],RootApp(Id)))))))),SDef("reverse-filter",[DefaultVarDec("s"),DefaultVarDec("tail")],Choice(Seq(Match(NoAnnoList(List([]))),CallNoArgs(SVar("tail"))),Seq(Match(NoAnnoList(ListTail([Var("x")],Var("xs")))),Seq(BA(Call(SVar("reverse-filter"),[CallNoArgs(SVar("s")),CallNoArgs(SVar("tail"))]),Var("xs")),Call(SVar("try"),[Build(NoAnnoList(ListTail([App(CallNoArgs(SVar("s")),Var("x"))],RootApp(Id))))]))))),SDef("filter-gen",[DefaultVarDec("pred"),VarDec("cont",FunType([FunType([ConstType(SortVar("term"))],ConstType(SortVar("term"))),ConstType(SortVar("term"))],ConstType(SortVar("term"))))],Rec("x",Choice(ListCongNoTail([]),LChoice(Seq(CallNoArgs(SVar("pred")),Call(SVar("cont"),[CallNoArgs(SVar("x"))])),Seq(CallNoArgs(SVar("Tl")),CallNoArgs(SVar("x"))))))),SDef("filter-option-args",[DefaultVarDec("flag")],Let([SDef("skip",[DefaultVarDec("s")],Call(SVar("at-tail"),[CallNoArgs(SVar("s"))]))],Call(SVar("filter-gen"),[Seq(ListCong([CallNoArgs(SVar("flag"))],Id),CallNoArgs(SVar("Tl"))),CallNoArgs(SVar("skip"))]))),SDef("filter-options",[DefaultVarDec("flag")],Let([SDef("skip",[DefaultVarDec("s")],Call(SVar("at-tail"),[Call(SVar("at-tail"),[CallNoArgs(SVar("s"))])]))],Call(SVar("filter-gen"),[ListCong([CallNoArgs(SVar("flag"))],Id),CallNoArgs(SVar("skip"))]))),SDef("list-some-filter",[DefaultVarDec("s")],Rec("x",LChoice(Seq(ListCong([CallNoArgs(SVar("s"))],Id),ListCong([Id],Call(SVar("filter"),[CallNoArgs(SVar("s"))]))),Seq(ListCong([Id],CallNoArgs(SVar("x"))),CallNoArgs(SVar("Tl")))))),SDef("partition",[DefaultVarDec("s")],Call(SVar("partition"),[CallNoArgs(SVar("s")),Id])),SDef("partition",[DefaultVarDec("s1"),DefaultVarDec("s2")],Rec("part",Choice(LRule(RuleNoCond(NoAnnoList(List([])),NoAnnoList(Tuple([NoAnnoList(List([])),NoAnnoList(List([]))])))),LChoice(ScopeDefault(Seq(ListCong([AM(CallNoArgs(SVar("s1")),Var("x"))],Id),Seq(Match(NoAnnoList(ListTail([Wld],RootApp(CallNoArgs(SVar("part")))))),Build(NoAnnoList(Tuple([NoAnnoList(ListTail([Var("x")],RootApp(CallNoArgs(SVar("Fst"))))),RootApp(CallNoArgs(SVar("Snd")))])))))),ScopeDefault(Seq(ListCong([AM(CallNoArgs(SVar("s2")),Var("x"))],Id),Seq(Match(NoAnnoList(ListTail([Wld],RootApp(CallNoArgs(SVar("part")))))),Build(NoAnnoList(Tuple([RootApp(CallNoArgs(SVar("Fst"))),NoAnnoList(ListTail([Var("x")],RootApp(CallNoArgs(SVar("Snd")))))])))))))))),SDef("partition'",[DefaultVarDec("s")],Rec("part",Choice(LRule(RuleNoCond(NoAnnoList(List([])),NoAnnoList(Tuple([NoAnnoList(List([])),NoAnnoList(List([]))])))),LRule(Rule(NoAnnoList(ListTail([Var("z")],Var("zs"))),RootApp(LChoice(Build(NoAnnoList(Tuple([NoAnnoList(ListTail([App(CallNoArgs(SVar("s")),Var("z"))],Var("xs"))),Var("ys")]))),Build(NoAnnoList(Tuple([Var("xs"),NoAnnoList(ListTail([Var("z")],Var("ys")))]))))),AM(BA(CallNoArgs(SVar("part")),Var("zs")),NoAnnoList(Tuple([Var("xs"),Var("ys")]))))))))])])
