public static List helpProjectNthColumn(int n, List tuplelist) {
    if (tuplelist == null) {
      return (null);
    }
    { List projectedlist = List.newList();
      Stella_Object item = null;

      { Stella_Object tuple = null;
        Cons iter000 = tuplelist.theConsList;
        Cons collect000 = null;

        loop000 : for (;!(iter000 == Stella.NIL); iter000 = iter000.rest) {
          tuple = iter000.value;
          { Surrogate testValue000 = Stella_Object.safePrimaryType(tuple);

            if (testValue000 == Logic.SGT_STELLA_CONS) {
              { Cons tuple000 = ((Cons)(tuple));

                item = tuple000.nth(n);
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_LIST)) {
              { List tuple000 = ((List)(tuple));

                item = tuple000.nth(n);
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_STELLA_COLLECTION)) {
              { Collection tuple000 = ((Collection)(tuple));

                { List members = Logic.assertedCollectionMembers(tuple000, false);

                  if (members != null) {
                    item = members.nth(n);
                  }
                  else {
                    continue loop000;
                  }
                }
              }
            }
            else if (Surrogate.subtypeOfP(testValue000, Logic.SGT_LOGIC_SKOLEM)) {
              { Skolem tuple000 = ((Skolem)(tuple));

                { List members = Logic.assertedCollectionMembers(tuple000, false);

                  if (members != null) {
                    item = members.nth(n);
                  }
                  else {
                    continue loop000;
                  }
                }
              }
            }
            else {
              {
                System.out.println("Can't handle tuple object `" + tuple + "'");
                System.out.println();
              }
;
              continue loop000;
            }
          }
          if (collect000 == null) {
            {
              collect000 = Cons.cons(item, Stella.NIL);
              if (projectedlist.theConsList == Stella.NIL) {
                projectedlist.theConsList = collect000;
              }
              else {
                Cons.addConsToEndOfConsList(projectedlist.theConsList, collect000);
              }
            }
          }
          else {
            {
              collect000.rest = Cons.cons(item, Stella.NIL);
              collect000 = collect000.rest;
            }
          }
        }
      }
      if (projectedlist.emptyP()) {
        return (null);
      }
      else {
        return (projectedlist);
      }
    }
  }