Module("collection/list/index",[Imports([Import("collection/list/cons"),Import("strategy/traversal/simple")]),Strategies([SDefNoArgs("index",Seq(Match(NoAnnoList(Tuple([Var("i"),RootApp(Id)]))),CallT(SVar("index"),[],[Var("i")])))]),Strategies([SDefT("index",[],[DefaultVarDec("i")],Seq(CallT(SVar("at-index"),[Match(Var("t"))],[App(CallNoArgs(SVar("dec")),Var("i"))]),Build(Var("t"))))]),Strategies([SDefNoArgs("get-index",Seq(CallNoArgs(SVar("Gind0")),Rec("x",LChoice(CallNoArgs(SVar("Gind1")),Seq(CallNoArgs(SVar("Gind2")),CallNoArgs(SVar("x"))))))),RDefNoArgs("Gind0",RuleNoCond(NoAnnoList(Tuple([Var("x"),Var("ys")])),NoAnnoList(Tuple([NoAnnoList(Int("1")),Var("x"),Var("ys")])))),RDefNoArgs("Gind1",RuleNoCond(NoAnnoList(Tuple([Var("n"),Var("x"),NoAnnoList(ListTail([Var("x")],Var("xs")))])),Var("n"))),RDefNoArgs("Gind2",RuleNoCond(NoAnnoList(Tuple([Var("n"),Var("y"),NoAnnoList(ListTail([Var("x")],Var("xs")))])),NoAnnoList(Tuple([App(CallNoArgs(SVar("add")),NoAnnoList(Tuple([Var("n"),NoAnnoList(Int("1"))]))),Var("y"),Var("xs")])))),SDef("get-index0",[DefaultVarDec("s")],Seq(Call(SVar("at-suffix"),[Seq(ListCong([CallNoArgs(SVar("s"))],Id),Build(NoAnnoList(List([]))))]),CallNoArgs(SVar("length"))))]),Strategies([SDefNoArgs("set-index",Seq(Match(NoAnnoList(Tuple([Var("i"),Var("x"),Var("xs")]))),BA(Call(SVar("at-index"),[Build(Var("x"))]),NoAnnoList(Tuple([Var("i"),Var("xs")]))))),SDef("at-index",[DefaultVarDec("s")],Seq(Match(NoAnnoList(Tuple([Var("i"),RootApp(Id)]))),CallT(SVar("at-index"),[CallNoArgs(SVar("s"))],[Var("i")]))),SDefT("at-index",[DefaultVarDec("s")],[DefaultVarDec("i")],Let([SDefT("next",[],[DefaultVarDec("j")],CondChoice(AM(Build(Var("j")),Var("i")),ListCong([CallNoArgs(SVar("s"))],Id),ListCong([Id],CallT(SVar("next"),[],[App(CallNoArgs(SVar("inc")),Var("j"))]))))],CallT(SVar("next"),[],[NoAnnoList(Int("0"))]))),SDefT("at-index-tail",[DefaultVarDec("s")],[DefaultVarDec("i")],Let([SDefT("next",[],[DefaultVarDec("j")],CondChoice(AM(Build(Var("j")),Var("i")),CallNoArgs(SVar("s")),ListCong([Id],CallT(SVar("next"),[],[App(CallNoArgs(SVar("inc")),Var("j"))]))))],CallT(SVar("next"),[],[NoAnnoList(Int("0"))])))]),Strategies([SDefNoArgs("insert",Seq(CallNoArgs(SVar("Ins0")),Rec("x",LChoice(CallNoArgs(SVar("Ins1")),Call(SVar("Ins2"),[CallNoArgs(SVar("x"))]))))),RDefNoArgs("Ins0",RuleNoCond(NoAnnoList(Tuple([Var("i"),Var("x"),Var("ys")])),NoAnnoList(Tuple([NoAnnoList(Int("0")),Var("i"),Var("x"),Var("ys")])))),RDefNoArgs("Ins1",RuleNoCond(NoAnnoList(Tuple([Var("i"),Var("i"),Var("x"),Var("xs")])),NoAnnoList(ListTail([Var("x")],Var("xs"))))),RDef("Ins2",[DefaultVarDec("r")],RuleNoCond(NoAnnoList(Tuple([Var("n"),Var("i"),Var("x"),NoAnnoList(ListTail([Var("y")],Var("ys")))])),NoAnnoList(ListTail([Var("y")],App(CallNoArgs(SVar("r")),NoAnnoList(Tuple([App(CallNoArgs(SVar("add")),NoAnnoList(Tuple([Var("n"),NoAnnoList(Int("1"))]))),Var("i"),Var("x"),Var("ys")])))))))]),Strategies([SDefT("nmap",[VarDec("s",FunType([ConstType(SortNoArgs("Int")),ConstType(SortVar("a"))],ConstType(SortVar("b"))))],[DefaultVarDec("i")],Choice(ListCongNoTail([]),ListCong([CallT(SVar("s"),[],[Var("i")])],CallT(SVar("nmap"),[CallNoArgs(SVar("s"))],[App(CallNoArgs(SVar("inc")),Var("i"))])))),SDef("map-with-index",[DefaultVarDec("s")],Let([SDefT("apply",[],[DefaultVarDec("i")],BA(CallNoArgs(SVar("s")),NoAnnoList(Tuple([Var("i"),RootApp(Id)]))))],CallT(SVar("nmap"),[CallNoArgs(SVar("apply"))],[NoAnnoList(Int("1"))]))),SDefNoArgs("add-indices",Call(SVar("map-with-index"),[Id]))])])
