;; | --------------------------------------------------------------------------- ;; | LI_SubList ;; | --------------------------------------------------------------------------- ;; | Function : Returns only a part of a list, works like SUBSTR ;; | Argument : [ Lst ] - List to check ;; | [ Start] - starting position, starts from 1 ;; | [ len ] - Number of elements to extract ;; | If len is negative, returns until the end of the list ;; | Return : The extracted list ;; | Updated : December18, 1998 ;; | e-mail : rakesh.rao@4d-technologies.com ;; | Web : www.4d-technologies.com ;; | --------------------------------------------------------------------------- (defun LI_SubList ( Lst Start len / _len n m _Lst) (if (minusp len) (setq len 999999999) ) (setq _len (length Lst) n (min (- Start 1) _len) ; Starting Index m (min (+ n len) _len) ; Ending Index _Lst '() ) (while (< n m) (setq _Lst (cons (nth n Lst) _Lst) n (1+ n) ) ) (reverse _Lst) )