(* Extrct.nb ------------------------------------------------------------ *) (* Given a sublist Y of a list W and a data list X which parallels W, this program extracts the data sublist Z for X which parallels Y. *) (* Utility Needed: WriteLstOfLst[]. *) (* User needs to specify the directory, the starting size, the ending size, the three input file families and the output file family. *) (* Change Directory: *) SetDirectory["J:/isis/home/c/a/cagann/public_html/Posets"]; << GenrlUtils.m; (* Change starting size: *) nstrt = 7; (* Change ending size: *) nend = 7; (* Change input file family W: *) wwfam = "HookPos/hookpos"; (* Change input file family X: *) xxfam = "HookLns/hooklns"; (* Change input file family Y: *) yyfam = "IDHLPos/idhlpos"; (* Change output file family Z: *) zzfam = "IDHLPhl/idhlphl"; Do[ ww = ReadList[ StringJoin[wwfam,ToString[nd]] ]; xx = ReadList[ StringJoin[xxfam,ToString[nd]] ]; yy = ReadList[ StringJoin[yyfam,ToString[nd]] ]; WriteLstOfLst[ StringJoin[zzfam,ToString[nd]], Extract[ xx, Position[ww,m_/; MemberQ[yy,m]] ] ] ,{nd,nstrt,nend}]; (* End of Extrct.nb. *)