(setvar "LOGFILEMODE" 0)
;;----- return input list without i-th element (recursive)
(defun hana_nth (i lst)
  (if (zerop i)
    (cdr lst)
    (cons (car lst) (hana_nth (1- i) (cdr lst)))
  )
)
;;----- return input list without i-th element (none-recursive)
(defun hana_nth_nonrec (i lst / rlst)
  (repeat i
    (setq rlst (cons (car lst) rlst))
    (setq lst (cdr lst))
  )
  (append (reverse rlst) (cdr lst))
)

(defun t_nthrec ( count fptr / i time1 time2 lst rlst  )

  ;;--- build data list
  (setq i 0)
  (setq lst nil)
  (repeat 10000
    (setq lst (cons i lst))
    (setq i (1+ i))
  )

  ;;--- now run test
  (setq t1 (getvar "date"))

  (repeat 200
    ;;(setq rlst (hana_nth 5000 lst))
    (setq rlst (hana_nth_nonrec 9000 lst))
  )

  ;;--- test results
  (setq t2   (getvar "date"))
  (setq sec  (* 864000.0 (- t2 t1)))
  (princ "\n   NTH-REC 1 process list / time : ") (princ (length lst)) (princ " / ") (princ sec)
  (princ)
)

;; to increase/decrease the number of bench loops : > 1 increase < 1 decrease
(if (not $benchcyclesfactor) (setq $benchcyclesfactor 1))

;; to run this loaded test manually
(defun C:Run ()
  (setvar "cmdecho" 0)
  (print)
  (t_nthrec (* 100 $benchcyclesfactor) nil)
  (setvar "cmdecho" 1)
  (princ)
)
