function from Java to R : The java code that im having is completely complex for me to translate to R. Can anyone help to solve convert to R from this java codes, because it is my reference to learn.

       public static void enumerate(int n) {
          int[] a = new int[n];
          enumerate(a, 0);
        }
      
      public static void enumerate(int[] q, int k) {
        int n = q.length;
        if (k == n) printQueens(q);
        else {
          for (int i = 0; i < n; i++) {
            q[k] = i;
            if (isConsistent(q, k)) enumerate(q, k+1);
          }
        }
      }


