import edu.neu.ccs.demeterf.lib.SepList; import edu.neu.ccs.demeterf.lib.List; /** A quick test of the new "imperative" demfgen.lib.List Methods */ public class SepListTest{ public static void main(String[] args){ if(args.length != 1){ p(" usage: SepListTest <length>"); System.exit(1); } int len = Integer.parseInt(args[0]); new SepListTest().main(len); } static void p(String s, boolean t){ p(s+" : "+t); } static void p(String s){ System.out.println(s); } void main(int len){ SepList<String,Integer> lst = SepList.create(); for(int i = len-1; i >= 0; i--){ lst = lst.push(i, " '"+i+"'"); } p("Length", lst.length() == len); p("List: "+lst); p("List: "+lst.reverse()); p("Lookup(4): "+lst.lookup(4)); } }